coolify/src/lib/queues/proxy.ts

17 lines
445 B
TypeScript
Raw Normal View History

2022-05-12 14:53:22 +00:00
import { ErrorHandler, prisma } from '$lib/database';
2022-02-28 23:08:54 +00:00
import { configureHAProxy } from '$lib/haproxy/configuration';
2022-02-10 14:47:44 +00:00
2022-04-06 19:04:51 +00:00
export default async function (): Promise<void | {
status: number;
body: { message: string; error: string };
}> {
2022-02-27 10:52:05 +00:00
try {
2022-05-12 14:53:22 +00:00
const settings = await prisma.setting.findFirst();
if (!settings.isTraefikUsed) {
return await configureHAProxy();
}
2022-02-27 10:52:05 +00:00
} catch (error) {
2022-03-01 14:22:11 +00:00
return ErrorHandler(error.response?.body || error);
2022-02-27 10:52:05 +00:00
}
2022-02-10 14:47:44 +00:00
}