code cleanup
This commit is contained in:
parent
4ed54568d3
commit
3deff162bb
@ -67,7 +67,6 @@ export const getTeam = (event) => {
|
||||
};
|
||||
|
||||
export const getUserDetails = async (event, isAdminRequired = true) => {
|
||||
// try {
|
||||
const teamId = getTeam(event);
|
||||
const userId = event.locals.session.data.uid || null;
|
||||
const { permission = 'read' } = await db.prisma.permission.findFirst({
|
||||
@ -91,18 +90,6 @@ export const getUserDetails = async (event, isAdminRequired = true) => {
|
||||
}
|
||||
|
||||
return payload;
|
||||
// } catch (err) {
|
||||
// console.log(err);
|
||||
// return {
|
||||
// teamId: null,
|
||||
// userId: null,
|
||||
// permission: 'read',
|
||||
// status: 401,
|
||||
// body: {
|
||||
// message: 'You do not have permission to do this. \nAsk an admin to modify your permissions.'
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
};
|
||||
|
||||
export function getEngine(engine) {
|
||||
|
@ -20,9 +20,6 @@
|
||||
|
||||
function showActions(value) {
|
||||
actionsShow = value;
|
||||
// if (value === false) {
|
||||
// showPassword = false;
|
||||
// }
|
||||
}
|
||||
function copyToClipboard() {
|
||||
if (isHttps && navigator.clipboard) {
|
||||
|
@ -6,7 +6,6 @@
|
||||
export let description;
|
||||
export let isPadding = true;
|
||||
export let disabled = false;
|
||||
// export let disabledReason = '';
|
||||
</script>
|
||||
|
||||
<li class="flex items-center py-4">
|
||||
@ -14,11 +13,6 @@
|
||||
<p class="text-xs font-bold text-stone-100 md:text-base">{title}</p>
|
||||
<Explainer text={description} />
|
||||
</div>
|
||||
<!-- {#if disabled}
|
||||
<div class="flex" class:px-4={isPadding} class:pr-32={!isPadding}>
|
||||
<p class="text-xs font-bold text-stone-400">{disabledReason}</p>
|
||||
</div>
|
||||
{:else} -->
|
||||
<div
|
||||
type="button"
|
||||
on:click
|
||||
|
@ -109,22 +109,4 @@ export async function setDestinationSettings({ engine, isCoolifyProxyUsed }) {
|
||||
where: { engine },
|
||||
data: { isCoolifyProxyUsed }
|
||||
});
|
||||
|
||||
// if (isCoolifyProxyUsed) {
|
||||
// await installCoolifyProxy(engine)
|
||||
// await configureNetworkCoolifyProxy(engine)
|
||||
// } else {
|
||||
// // TODO: must check if other destination is using the proxy??? or not?
|
||||
// const domain = await prisma.setting.findUnique({ where: { name: 'domain' }, rejectOnNotFound: false })
|
||||
// if (!domain) {
|
||||
// await uninstallCoolifyProxy(engine)
|
||||
// } else {
|
||||
// return {
|
||||
// stastus: 500,
|
||||
// body: {
|
||||
// message: 'You can not disable the Coolify proxy while the domain is set for Coolify itself.'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -97,17 +97,6 @@ export async function login({ email, password }) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// const token = jsonwebtoken.sign({}, secretKey, {
|
||||
// expiresIn: 15778800,
|
||||
// algorithm: 'HS256',
|
||||
// audience: 'coolify',
|
||||
// issuer: 'coolify',
|
||||
// jwtid: uid,
|
||||
// subject: `User:${uid}`,
|
||||
// notBefore: -1000
|
||||
// });
|
||||
|
||||
return {
|
||||
status: 200,
|
||||
headers: {
|
||||
|
@ -188,94 +188,7 @@ export async function deleteProxy({ id }) {
|
||||
await completeTransaction(transactionId);
|
||||
}
|
||||
}
|
||||
// export async function configureProxyForDatabase({ id, port, isPublic, privatePort }) {
|
||||
// const haproxy = await haproxyInstance()
|
||||
// try {
|
||||
// await checkHAProxy()
|
||||
// } catch (error) {
|
||||
// return
|
||||
// }
|
||||
|
||||
// let alreadyConfigured = false
|
||||
// try {
|
||||
// const backend: any = await haproxy.get(`v2/services/haproxy/configuration/backends/${id}`).json()
|
||||
// const server: any = await haproxy.get(`v2/services/haproxy/configuration/servers/${id}`, {
|
||||
// searchParams: {
|
||||
// backend: id
|
||||
// },
|
||||
// }).json()
|
||||
// if (backend.data.name === id) {
|
||||
// if (server.data.port === privatePort) {
|
||||
// if (server.data.check === 'enabled') {
|
||||
// if (server.data.address === id) {
|
||||
// alreadyConfigured = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.log('error getting backend or server', error.response.body)
|
||||
// }
|
||||
// if (alreadyConfigured) return
|
||||
|
||||
// const transactionId = await getNextTransactionId()
|
||||
// try {
|
||||
// await haproxy.post('v2/services/haproxy/configuration/backends', {
|
||||
// searchParams: {
|
||||
// transaction_id: transactionId
|
||||
// },
|
||||
// json: {
|
||||
// "init-addr": "last,libc,none",
|
||||
// "mode": "tcp",
|
||||
// "name": id
|
||||
// }
|
||||
// })
|
||||
// await haproxy.post('v2/services/haproxy/configuration/servers', {
|
||||
// searchParams: {
|
||||
// transaction_id: transactionId,
|
||||
// backend: id
|
||||
// },
|
||||
// json: {
|
||||
// "address": id,
|
||||
// "check": "enabled",
|
||||
// "name": id,
|
||||
// "port": privatePort
|
||||
// }
|
||||
// })
|
||||
// await haproxy.post('v2/services/haproxy/configuration/frontends', {
|
||||
// searchParams: {
|
||||
// transaction_id: transactionId,
|
||||
// backend: id
|
||||
// },
|
||||
// json: {
|
||||
// "default_backend": id,
|
||||
// "mode": "tcp",
|
||||
// "name": id
|
||||
// }
|
||||
// })
|
||||
// await haproxy.post('v2/services/haproxy/configuration/binds', {
|
||||
// searchParams: {
|
||||
// transaction_id: transactionId,
|
||||
// frontend: id
|
||||
// },
|
||||
// json: {
|
||||
// "address": "*",
|
||||
// "name": id,
|
||||
// "port": port
|
||||
// }
|
||||
// })
|
||||
// } catch (error) {
|
||||
// console.log(error.response.body)
|
||||
// throw error.response.body
|
||||
// } finally {
|
||||
// try {
|
||||
// await completeTransaction(transactionId)
|
||||
// } catch (error) {
|
||||
// console.log(error.response.body)
|
||||
// }
|
||||
// }
|
||||
// await configureDatabaseVisibility({ id, isPublic })
|
||||
// }
|
||||
export async function reloadHaproxy(engine) {
|
||||
const host = getEngine(engine);
|
||||
return await asyncExecShell(`DOCKER_HOST=${host} docker exec coolify-haproxy kill -HUP 1`);
|
||||
|
@ -64,10 +64,6 @@ export default async function (job) {
|
||||
if (destinationDockerId) {
|
||||
destinationType = 'docker';
|
||||
}
|
||||
// Not implemented yet
|
||||
// if (destinationKubernetesId) {
|
||||
// destinationType = 'kubernetes'
|
||||
// }
|
||||
|
||||
if (destinationType === 'docker') {
|
||||
const docker = dockerInstance({ destinationDocker });
|
||||
|
@ -144,28 +144,6 @@ buildWorker.on('failed', async (job: Bullmq.Job, failedReason) => {
|
||||
});
|
||||
});
|
||||
|
||||
// const letsEncryptQueueName = dev ? cuid() : 'letsencrypt_queue'
|
||||
// const letsEncryptQueue = new Queue(letsEncryptQueueName, connectionOptions)
|
||||
|
||||
// const letsEncryptWorker = new Worker(letsEncryptQueueName, async (job) => await letsencrypt(job), {
|
||||
// concurrency: 1,
|
||||
// ...connectionOptions
|
||||
// })
|
||||
// letsEncryptWorker.on('completed', async () => {
|
||||
// // TODO: Save letsencrypt logs as build logs!
|
||||
// console.log('[DEBUG] Lets Encrypt job completed')
|
||||
// })
|
||||
|
||||
// letsEncryptWorker.on('failed', async (job: Job, failedReason: string) => {
|
||||
// try {
|
||||
// await prisma.applicationSettings.updateMany({ where: { applicationId: job.data.id }, data: { forceSSL: false } })
|
||||
// } catch (error) {
|
||||
// console.log(error)
|
||||
// }
|
||||
// console.log('[DEBUG] Lets Encrypt job failed')
|
||||
// console.log(failedReason)
|
||||
// })
|
||||
|
||||
const buildLogQueueName = dev ? cuid() : 'log_queue';
|
||||
const buildLogQueue = new Queue(buildLogQueueName, connectionOptions);
|
||||
const buildLogWorker = new Worker(buildLogQueueName, async (job) => await logger(job), {
|
||||
|
@ -124,25 +124,6 @@
|
||||
updateStatus.success = false;
|
||||
updateStatus.loading = false;
|
||||
}
|
||||
// } else {
|
||||
// let reachable = false;
|
||||
// let tries = 0;
|
||||
// do {
|
||||
// await asyncSleep(1000);
|
||||
// try {
|
||||
// await get(`/undead.json`);
|
||||
// reachable = true;
|
||||
// } catch (error) {
|
||||
// console.log(error);
|
||||
// reachable = false;
|
||||
// }
|
||||
// if (reachable) break;
|
||||
// tries++;
|
||||
// } while (!reachable || tries < 120);
|
||||
// toast.push('New version reachable. Reloading...');
|
||||
// await asyncSleep(2000);
|
||||
// window.location.reload();
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -142,14 +142,6 @@
|
||||
return errorNotification('Branch already configured');
|
||||
}
|
||||
}
|
||||
// async function saveDeployKey(deployKeyId: number) {
|
||||
// try {
|
||||
// await post(updateDeployKeyIdUrl, { deployKeyId });
|
||||
// } catch (error) {
|
||||
// errorNotification(error);
|
||||
// throw new Error(error);
|
||||
// }
|
||||
// }
|
||||
async function checkSSHKey(sshkeyUrl) {
|
||||
try {
|
||||
return await post(sshkeyUrl, {});
|
||||
|
@ -25,9 +25,7 @@ export const get: RequestHandler = async (event) => {
|
||||
state = 'running';
|
||||
}
|
||||
} catch (error) {
|
||||
// if (!error.stderr.includes('No such object')) {
|
||||
// console.log(error)
|
||||
// }
|
||||
//
|
||||
}
|
||||
}
|
||||
const configuration = generateDatabaseConfiguration(database);
|
||||
|
@ -46,24 +46,3 @@ export const get: RequestHandler = async (event) => {
|
||||
return PrismaErrorHandler(error);
|
||||
}
|
||||
};
|
||||
|
||||
// export const post: RequestHandler<Locals, FormData> = async (request) => {
|
||||
// const { teamId, status, body } = await getUserDetails(request);
|
||||
// if (status === 401) return { status, body }
|
||||
// const { id } = request.params
|
||||
|
||||
// const name = request.body.get('name')
|
||||
// const defaultDatabase = request.body.get('defaultDatabase')
|
||||
// const dbUser = request.body.get('dbUser')
|
||||
// const dbUserPassword = request.body.get('dbUserPassword')
|
||||
// const rootUser = request.body.get('rootUser')
|
||||
// const rootUserPassword = request.body.get('rootUserPassword')
|
||||
// const version = request.body.get('version')
|
||||
|
||||
// try {
|
||||
// return await db.updateDatabase({ id, name, defaultDatabase, dbUser, dbUserPassword, rootUser, rootUserPassword, version })
|
||||
// } catch (err) {
|
||||
// return err
|
||||
// }
|
||||
|
||||
// }
|
||||
|
@ -71,8 +71,6 @@
|
||||
window.open(`${source.htmlUrl}/groups/${payload.groupName}/-/settings/applications`);
|
||||
break;
|
||||
case 'instance':
|
||||
// TODO: This is not correct
|
||||
// window.location.assign(`${source.htmlUrl}/-/profile/applications`);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user