reverseproxy: notify cert change only in cron job

notifying this in ensureCertificate does not work if provider changed in the middle anyway.
might as well get them to be in sync in the cronjob.

this change also resulted in tls addon getting restarted non-stop if you change from wildcard
to non-wildcard since ensureCertificate notifies the change.
This commit is contained in:
Girish Ramakrishnan
2022-11-30 15:16:16 +01:00
parent 69b46d82ab
commit f27847950c
4 changed files with 39 additions and 29 deletions
+4 -4
View File
@@ -4,7 +4,7 @@ exports = module.exports = {
start,
stop,
handleCertChanged,
checkCertificate,
validateConfig,
applyConfig
@@ -366,14 +366,14 @@ async function stop() {
gServer = null;
}
async function handleCertChanged() {
async function checkCertificate() {
const certificate = await reverseProxy.getDirectoryServerCertificate();
if (certificate.cert === gCertificate.cert) {
debug('handleCertChanged: certificate has not changed');
debug('checkCertificate: certificate has not changed');
return;
}
debug('handleCertChanged: certificate changed. restarting');
debug('checkCertificate: certificate changed. restarting');
await stop();
await start();
}