certs: fix renewal notification

This commit is contained in:
Girish Ramakrishnan
2021-06-24 00:54:28 -07:00
parent 2b13593630
commit b24cf78bc0
3 changed files with 19 additions and 11 deletions

View File

@@ -438,7 +438,7 @@ function ensureCertificate(vhost, domain, auditSource, callback) {
acmeApi.getCertificate(vhost, domain, acmePaths, apiOptions, async function (error) {
debug(`ensureCertificate: error: ${error ? error.message : 'null'} cert: ${acmePaths.certFilePath || 'null'}`);
eventlog.add(currentBundle ? eventlog.ACTION_CERTIFICATE_RENEWAL : eventlog.ACTION_CERTIFICATE_NEW, auditSource, { domain: vhost, errorMessage: error ? error.message : '', notAfter });
await safe(eventlog.add(currentBundle ? eventlog.ACTION_CERTIFICATE_RENEWAL : eventlog.ACTION_CERTIFICATE_NEW, auditSource, { domain: vhost, errorMessage: error ? error.message : '', notAfter }));
if (error && currentBundle && (notAfter - new Date() > 0)) { // still some life left in this certificate
debug('ensureCertificate: continue using existing bundle since renewal failed');