reverseproxy: add option to force renewal for e2e
This commit is contained in:
@@ -378,8 +378,9 @@ async function writeCertificate(location) {
|
||||
return { certFilePath, keyFilePath };
|
||||
}
|
||||
|
||||
async function ensureCertificate(location, auditSource) {
|
||||
async function ensureCertificate(location, options, auditSource) {
|
||||
assert.strictEqual(typeof location, 'object');
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
const domainObject = await domains.get(location.domain);
|
||||
@@ -402,7 +403,7 @@ async function ensureCertificate(location, auditSource) {
|
||||
const cert = await blobs.getString(`${blobs.CERT_PREFIX}-${certName}.cert`);
|
||||
|
||||
if (key && cert) {
|
||||
if (providerMatchesSync(domainObject, cert) && !needsRenewalSync(cert)) {
|
||||
if (!options.forceRenewal && providerMatchesSync(domainObject, cert) && !needsRenewalSync(cert)) { // force is for e2e
|
||||
debug(`ensureCertificate: ${fqdn} acme cert exists and is up to date`);
|
||||
return;
|
||||
}
|
||||
@@ -547,7 +548,7 @@ async function configureApp(app, auditSource) {
|
||||
const locations = getAppLocationsSync(app);
|
||||
|
||||
for (const location of locations) {
|
||||
await ensureCertificate(location, auditSource);
|
||||
await ensureCertificate(location, {}, auditSource);
|
||||
}
|
||||
|
||||
await writeAppConfigs(app);
|
||||
@@ -625,7 +626,7 @@ async function checkCerts(options, auditSource, progressCallback) {
|
||||
for (const location of locations) {
|
||||
percent += Math.round(100/locations.length);
|
||||
progressCallback({ percent, message: `Ensuring certs of ${location.fqdn}` });
|
||||
await ensureCertificate(location, auditSource);
|
||||
await ensureCertificate(location, options, auditSource);
|
||||
}
|
||||
|
||||
if (options.rebuild || fs.existsSync(paths.REVERSE_PROXY_REBUILD_FILE)) {
|
||||
|
||||
Reference in New Issue
Block a user