code cleanup
This commit is contained in:
@@ -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`);
|
||||
|
Reference in New Issue
Block a user