remove usage of constants.DASHBOARD_SUBDOMAIN

This commit is contained in:
Girish Ramakrishnan
2024-04-27 11:10:24 +02:00
parent 5420630453
commit 2a6368af60
4 changed files with 18 additions and 16 deletions
+6 -5
View File
@@ -197,8 +197,8 @@ async function initialize() {
await tasks.stopAllTasks();
// always generate webadmin config since we have no versioning mechanism for the ejs
const { domain:dashboardDomain } = await dashboard.getLocation();
if (dashboardDomain) await onDashboardLocationSet(dashboardDomain);
const dashboardLocation = await dashboard.getLocation();
if (dashboardLocation.domain) await onDashboardLocationSet(dashboardLocation.subdomain, dashboardLocation.domain);
// configure nginx to be reachable by IP when not activated. for the moment, the IP based redirect exists even after domain is setup
// just in case user forgot or some network error happenned in the middle (then browser refresh takes you to activation page)
@@ -253,10 +253,11 @@ async function onDeactivated() {
await oidc.stop();
}
async function onDashboardLocationSet(dashboardDomain) {
assert.strictEqual(typeof dashboardDomain, 'string');
async function onDashboardLocationSet(subdomain, domain) {
assert.strictEqual(typeof subdomain, 'string');
assert.strictEqual(typeof domain, 'string');
await safe(reverseProxy.writeDashboardConfig(dashboardDomain), { debug }); // ok to fail if no disk space
await safe(reverseProxy.writeDashboardConfig(subdomain, domain), { debug }); // ok to fail if no disk space
await oidc.start();
}