rename variable to avoid shadowing
This commit is contained in:
@@ -32,7 +32,6 @@ exports = module.exports = {
|
||||
const acme2 = require('./acme2.js'),
|
||||
apps = require('./apps.js'),
|
||||
assert = require('assert'),
|
||||
async = require('async'),
|
||||
blobs = require('./blobs.js'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
constants = require('./constants.js'),
|
||||
@@ -658,7 +657,7 @@ async function renewCerts(options, auditSource, progressCallback) {
|
||||
|
||||
if (options.domain) appDomains = appDomains.filter(function (appDomain) { return appDomain.domain === options.domain; });
|
||||
|
||||
let progress = 1, renewed = [];
|
||||
let progress = 1, renewedCerts = [];
|
||||
|
||||
for (const appDomain of appDomains) {
|
||||
progressCallback({ percent: progress, message: `Ensuring certs of ${appDomain.fqdn}` });
|
||||
@@ -666,7 +665,7 @@ async function renewCerts(options, auditSource, progressCallback) {
|
||||
|
||||
const { bundle, renewed } = await ensureCertificate(appDomain.fqdn, appDomain.domain, auditSource);
|
||||
|
||||
if (renewed) renewed.push(appDomain.fqdn);
|
||||
if (renewed) renewedCerts.push(appDomain.fqdn);
|
||||
|
||||
if (appDomain.type === 'mail') continue; // mail has no nginx config to check current cert
|
||||
|
||||
@@ -690,15 +689,15 @@ async function renewCerts(options, auditSource, progressCallback) {
|
||||
}
|
||||
}
|
||||
|
||||
debug(`renewCerts: Renewed certs of ${JSON.stringify(renewed)}`);
|
||||
if (renewed.length === 0) return;
|
||||
debug(`renewCerts: Renewed certs of ${JSON.stringify(renewedCerts)}`);
|
||||
if (renewedCerts.length === 0) return;
|
||||
|
||||
if (renewed.includes(settings.mailFqdn())) await mail.handleCertChanged();
|
||||
if (renewedCerts.includes(settings.mailFqdn())) await mail.handleCertChanged();
|
||||
|
||||
await reload(); // reload nginx if any certs were updated but the config was not rewritten
|
||||
|
||||
// restart tls apps on cert change
|
||||
const tlsApps = allApps.filter(app => app.manifest.addons && app.manifest.addons.tls && renewed.includes(app.fqdn));
|
||||
const tlsApps = allApps.filter(app => app.manifest.addons && app.manifest.addons.tls && renewedCerts.includes(app.fqdn));
|
||||
for (const app of tlsApps) {
|
||||
await apps.restart(app, auditSource);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user