move dashboard setting into dashboard.js
This commit is contained in:
@@ -31,6 +31,7 @@ const apps = require('./apps.js'),
|
||||
constants = require('./constants.js'),
|
||||
cron = require('./cron.js'),
|
||||
debug = require('debug')('box:cloudron'),
|
||||
dashboard = require('./dashboard.js'),
|
||||
dns = require('./dns.js'),
|
||||
dockerProxy = require('./dockerproxy.js'),
|
||||
eventlog = require('./eventlog.js'),
|
||||
@@ -104,9 +105,9 @@ async function runStartupTasks() {
|
||||
|
||||
// always generate webadmin config since we have no versioning mechanism for the ejs
|
||||
tasks.push(async function () {
|
||||
if (!settings.dashboardDomain()) return;
|
||||
if (!await dashboard.getDomain()) return;
|
||||
|
||||
await reverseProxy.writeDashboardConfig(settings.dashboardDomain());
|
||||
await reverseProxy.writeDashboardConfig(await dashboard.getDomain());
|
||||
});
|
||||
|
||||
tasks.push(async function () {
|
||||
@@ -142,14 +143,15 @@ async function getConfig() {
|
||||
if (release === null) throw new BoxError(BoxError.FS_ERROR, safe.error.message);
|
||||
const ubuntuVersion = release.match(/DISTRIB_DESCRIPTION="(.*)"/)[1];
|
||||
const profileConfig = await users.getProfileConfig();
|
||||
const { fqdn:adminFqdn, domain:adminDomain } = await dashboard.getLocation();
|
||||
|
||||
// be picky about what we send out here since this is sent for 'normal' users as well
|
||||
return {
|
||||
apiServerOrigin: await appstore.getApiServerOrigin(),
|
||||
webServerOrigin: await appstore.getWebServerOrigin(),
|
||||
consoleServerOrigin: await appstore.getConsoleServerOrigin(),
|
||||
adminDomain: settings.dashboardDomain(),
|
||||
adminFqdn: settings.dashboardFqdn(),
|
||||
adminDomain,
|
||||
adminFqdn,
|
||||
mailFqdn: await mailServer.getLocation().fqdn,
|
||||
version: constants.VERSION,
|
||||
ubuntuVersion,
|
||||
@@ -192,7 +194,7 @@ async function setDashboardDomain(domain, auditSource) {
|
||||
await reverseProxy.writeDashboardConfig(domain);
|
||||
const fqdn = dns.fqdn(constants.DASHBOARD_SUBDOMAIN, domain);
|
||||
|
||||
await settings.setDashboardLocation(domain, fqdn);
|
||||
await dashboard.setLocation(domain, fqdn);
|
||||
|
||||
await safe(appstore.updateCloudron({ domain }), { debug });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user