WIP proxy

This commit is contained in:
Andras Bacsai 2022-03-01 00:20:28 +01:00
parent 0325343ede
commit cb90f692f2

View File

@ -60,10 +60,11 @@ backend backend-certbot
server certbot host.docker.internal:9080 server certbot host.docker.internal:9080
{{#applications}} {{#applications}}
{{#isRunning}}
backend {{domain}} backend {{domain}}
option forwardfor option forwardfor
server {{id}} {{id}}:{{port}} server {{id}} {{id}}:{{port}}
{{/isRunning}}
{{/applications}} {{/applications}}
{{#services}} {{#services}}
@ -108,6 +109,7 @@ export async function configureHAProxy() {
id, id,
port, port,
domain, domain,
isRunning,
isHttps, isHttps,
redirectValue, redirectValue,
redirectTo: isWWW ? domain : 'www.' + domain redirectTo: isWWW ? domain : 'www.' + domain
@ -139,7 +141,7 @@ export async function configureHAProxy() {
// } // }
// } // }
const output = mustache.render(template, data); const output = mustache.render(template, data);
const newHash = crypto.createHash('md5').update(JSON.stringify(template)).digest('hex'); const newHash = crypto.createHash('md5').update(output).digest('hex');
const { proxyHash, id } = await db.listSettings(); const { proxyHash, id } = await db.listSettings();
if (proxyHash !== newHash) { if (proxyHash !== newHash) {
await db.prisma.setting.update({ where: { id }, data: { proxyHash: newHash } }); await db.prisma.setting.update({ where: { id }, data: { proxyHash: newHash } });