move dashboard setting into dashboard.js

This commit is contained in:
Girish Ramakrishnan
2023-08-11 19:41:05 +05:30
parent 27ce8f9351
commit eee49a8291
25 changed files with 157 additions and 156 deletions
+6 -5
View File
@@ -11,6 +11,7 @@ const assert = require('assert'),
backups = require('./backups.js'),
backuptask = require('./backuptask.js'),
BoxError = require('./boxerror.js'),
dashboard = require('./dashboard.js'),
constants = require('./constants.js'),
cloudron = require('./cloudron.js'),
debug = require('debug')('box:provision'),
@@ -24,7 +25,6 @@ const assert = require('assert'),
reverseProxy = require('./reverseproxy.js'),
safe = require('safetydance'),
semver = require('semver'),
settings = require('./settings.js'),
paths = require('./paths.js'),
system = require('./system.js'),
users = require('./users.js'),
@@ -64,7 +64,7 @@ async function ensureDhparams() {
async function unprovision() {
// TODO: also cancel any existing configureWebadmin task
await settings.setDashboardLocation('', '');
await dashboard.setLocation('', '');
await mail.clearDomains();
await domains.clear();
}
@@ -177,8 +177,8 @@ async function restoreTask(backupConfig, remotePath, ipv4Config, options, auditS
await network.setIPv4Config(ipv4Config);
await reverseProxy.restoreFallbackCertificates();
const dashboardDomain = settings.dashboardDomain(); // load this fresh from after the backup.restore
if (!options.skipDnsSetup) await cloudron.setupDnsAndCert(constants.DASHBOARD_SUBDOMAIN, dashboardDomain, auditSource, (progress) => setProgress('restore', progress.message));
const { subdomain:dashboardSubdomain, domain:dashboardDomain } = await dashboard.getLocation(); // load this fresh from after the backup.restore
if (!options.skipDnsSetup) await cloudron.setupDnsAndCert(dashboardSubdomain, dashboardDomain, auditSource, (progress) => setProgress('restore', progress.message));
await cloudron.setDashboardDomain(dashboardDomain, auditSource);
await backups.setConfig(backupConfig);
@@ -246,7 +246,8 @@ async function restore(backupConfig, remotePath, version, ipv4Config, options, a
}
async function getStatus() {
gStatus.adminFqdn = settings.dashboardDomain() ? settings.dashboardFqdn() : null; // indicator for main.js if dnssetup was already done but not activated
const { fqdn:dashboardFqdn } = await dashboard.getLocation();
gStatus.adminFqdn = dashboardFqdn; // indicator for main.js if dnssetup was already done but not activated
gStatus.activated = await users.isActivated(); // indicator for admin setup
gStatus.provider = await system.getProvider(); // preselect dns provider and ami token
return gStatus;