*Only load ssl in setup if it is the bootup process
This commit is contained in:
parent
c9f1893f63
commit
79139fa980
12
src/relay.ts
12
src/relay.ts
|
@ -56,7 +56,7 @@ export async function start() {
|
||||||
|
|
||||||
let httpServer = http.createServer(app);
|
let httpServer = http.createServer(app);
|
||||||
|
|
||||||
cron.schedule("0 * * * *", setupSSl);
|
cron.schedule("0 * * * *", setupSSl.bind(null, false));
|
||||||
|
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
httpServer.listen(80, "0.0.0.0", function () {
|
httpServer.listen(80, "0.0.0.0", function () {
|
||||||
|
@ -84,10 +84,10 @@ export async function start() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await setupSSl();
|
await setupSSl(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setupSSl() {
|
async function setupSSl(bootup: boolean) {
|
||||||
let sslCert = await getSslCert();
|
let sslCert = await getSslCert();
|
||||||
let sslKey = await getSslKey();
|
let sslKey = await getSslKey();
|
||||||
let certInfo;
|
let certInfo;
|
||||||
|
@ -125,8 +125,10 @@ async function setupSSl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dateValid && domainValid) {
|
if (dateValid && domainValid) {
|
||||||
sslCtx = tls.createSecureContext(sslParams);
|
if (bootup) {
|
||||||
log.info(`Loaded SSL Certificate for ${configDomain}`);
|
sslCtx = tls.createSecureContext(sslParams);
|
||||||
|
log.info(`Loaded SSL Certificate for ${configDomain}`);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue