On dashboard or email location change, reconfigure immediately
This commit is contained in:
@@ -6,6 +6,7 @@ exports = module.exports = {
|
||||
|
||||
onActivated,
|
||||
onDashboardLocationChanged,
|
||||
onMailServerLocationChanged,
|
||||
|
||||
getStatus
|
||||
};
|
||||
@@ -93,12 +94,12 @@ async function markApps(existingInfra, restoreOptions) {
|
||||
assert.strictEqual(typeof restoreOptions, 'object');
|
||||
|
||||
if (existingInfra.version === 'none') { // cloudron is being restored from backup
|
||||
debug('markApps: restoring installed apps');
|
||||
await apps.restoreInstalledApps(restoreOptions, AuditSource.PLATFORM);
|
||||
debug('markApps: restoring apps');
|
||||
await apps.restoreApps(await apps.list(), restoreOptions, AuditSource.PLATFORM);
|
||||
} else if (existingInfra.version !== infra.version) {
|
||||
debug('markApps: reconfiguring installed apps');
|
||||
debug('markApps: reconfiguring apps');
|
||||
reverseProxy.removeAppConfigs(); // should we change the cert location, nginx will not start
|
||||
await apps.configureInstalledApps(await apps.list(), AuditSource.PLATFORM);
|
||||
await apps.configureApps(await apps.list(), { scheduleNow: false }, AuditSource.PLATFORM); // we will schedule it when infra is ready
|
||||
} else {
|
||||
let changedAddons = [];
|
||||
if (infra.images.mysql !== existingInfra.images.mysql) changedAddons.push('mysql');
|
||||
@@ -235,10 +236,18 @@ async function onDashboardLocationChanged(auditSource) {
|
||||
|
||||
// mark apps using oidc addon to be reconfigured
|
||||
const [, installedApps] = await safe(apps.list());
|
||||
await safe(apps.configureInstalledApps(installedApps.filter((a) => !!a.manifest.addons.oidc), auditSource));
|
||||
await safe(apps.configureApps(installedApps.filter((a) => !!a.manifest.addons?.oidc), { scheduleNow: true }, auditSource));
|
||||
|
||||
await safe(services.rebuildService('turn', auditSource), { debug }); // to update the realm variable
|
||||
|
||||
await oidc.stop();
|
||||
await oidc.start();
|
||||
}
|
||||
|
||||
async function onMailServerLocationChanged(auditSource) {
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
// mark apps using email addon to be reconfigured
|
||||
const [, installedApps] = await safe(apps.list());
|
||||
await safe(apps.configureApps(installedApps.filter((a) => !!a.manifest.addons?.email), { scheduleNow: true }, auditSource));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user