*Only load ssl in setup if it is the bootup process

This commit is contained in:
Derrick Hammer 2022-07-25 03:05:38 -04:00
parent c9f1893f63
commit 79139fa980
1 changed files with 7 additions and 5 deletions

View File

@ -56,7 +56,7 @@ export async function start() {
let httpServer = http.createServer(app);
cron.schedule("0 * * * *", setupSSl);
cron.schedule("0 * * * *", setupSSl.bind(null, false));
await new Promise((resolve) => {
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 sslKey = await getSslKey();
let certInfo;
@ -125,8 +125,10 @@ async function setupSSl() {
}
if (dateValid && domainValid) {
sslCtx = tls.createSecureContext(sslParams);
log.info(`Loaded SSL Certificate for ${configDomain}`);
if (bootup) {
sslCtx = tls.createSecureContext(sslParams);
log.info(`Loaded SSL Certificate for ${configDomain}`);
}
return;
}