re-configure does not require oldConfig

this is only needed when changing location now. the configure()
is now entirely local i.e rebuild local container and the reverse
proxy config
This commit is contained in:
Girish Ramakrishnan
2019-12-06 09:23:58 -08:00
parent ffeb484a10
commit 7ab9f3fa2f
2 changed files with 2 additions and 23 deletions

View File

@@ -772,42 +772,22 @@ function migrateDataDir(app, args, progressCallback, callback) {
});
}
// configure is called for an infra update and repair
// configure is called for an infra update and repair to re-create container, reverseproxy config. it's all "local"
function configure(app, args, progressCallback, callback) {
assert.strictEqual(typeof app, 'object');
assert.strictEqual(typeof args, 'object');
assert.strictEqual(typeof progressCallback, 'function');
assert.strictEqual(typeof callback, 'function');
const oldConfig = args.oldConfig || null;
const overwriteDns = args.overwriteDns;
async.series([
progressCallback.bind(null, { percent: 10, message: 'Cleaning up old install' }),
unconfigureReverseProxy.bind(null, app),
deleteContainers.bind(null, app, { managedOnly: true }),
function (next) {
if (!oldConfig) return next();
let obsoleteDomains = oldConfig.alternateDomains.filter(function (o) {
return !app.alternateDomains.some(function (n) { return n.subdomain === o.subdomain && n.domain === o.domain; });
});
if (oldConfig.fqdn !== app.fqdn) obsoleteDomains.push({ subdomain: oldConfig.location, domain: oldConfig.domain });
if (obsoleteDomains.length === 0) return next();
unregisterSubdomains(app, obsoleteDomains, next);
},
reserveHttpPort.bind(null, app),
progressCallback.bind(null, { percent: 20, message: 'Downloading icon' }),
downloadIcon.bind(null, app),
progressCallback.bind(null, { percent: 30, message: 'Registering subdomains' }),
registerSubdomains.bind(null, app, overwriteDns),
progressCallback.bind(null, { percent: 40, message: 'Downloading image' }),
downloadImage.bind(null, app.manifest),