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
+15 -10
View File
@@ -39,6 +39,7 @@ const addonConfigs = require('./addonconfigs.js'),
BoxError = require('./boxerror.js'),
constants = require('./constants.js'),
crypto = require('crypto'),
dashboard = require('./dashboard.js'),
debug = require('debug')('box:services'),
dig = require('./dig.js'),
docker = require('./docker.js'),
@@ -893,11 +894,13 @@ async function setupTurn(app, options) {
const turnSecret = await blobs.getString(blobs.ADDON_TURN_SECRET);
if (!turnSecret) throw new BoxError(BoxError.ADDONS_ERROR, 'Turn secret is missing');
const { fqdn:dashboardFqdn } = await dashboard.getLocation();
const env = [
{ name: 'CLOUDRON_STUN_SERVER', value: settings.dashboardFqdn() },
{ name: 'CLOUDRON_STUN_SERVER', value: dashboardFqdn },
{ name: 'CLOUDRON_STUN_PORT', value: '3478' },
{ name: 'CLOUDRON_STUN_TLS_PORT', value: '5349' },
{ name: 'CLOUDRON_TURN_SERVER', value: settings.dashboardFqdn() },
{ name: 'CLOUDRON_TURN_SERVER', value: dashboardFqdn },
{ name: 'CLOUDRON_TURN_PORT', value: '3478' },
{ name: 'CLOUDRON_TURN_TLS_PORT', value: '5349' },
{ name: 'CLOUDRON_TURN_SECRET', value: turnSecret }
@@ -915,7 +918,7 @@ async function startTurn(existingInfra) {
const image = infra.images.turn;
const memoryLimit = serviceConfig.memoryLimit || SERVICES['turn'].defaultMemoryLimit;
const memory = await system.getMemoryAllocation(memoryLimit);
const realm = settings.dashboardFqdn();
const { fqdn:realm } = await dashboard.getLocation();
let turnSecret = await blobs.getString(blobs.ADDON_TURN_SECRET);
if (!turnSecret) {
@@ -1995,14 +1998,16 @@ async function getDynamicEnvironmentOidc(app, options) {
const tmp = {};
const { fqdn:dashboardFqdn } = await dashboard.getLocation();
if (app.sso && app.manifest.addons['oidc']) {
tmp['CLOUDRON_OIDC_DISCOVERY_URL'] = `https://${settings.dashboardFqdn()}/openid/.well-known/openid-configuration`;
tmp['CLOUDRON_OIDC_ISSUER'] = `https://${settings.dashboardFqdn()}/openid`;
tmp['CLOUDRON_OIDC_AUTH_ENDPOINT'] = `https://${settings.dashboardFqdn()}/openid/auth`;
tmp['CLOUDRON_OIDC_TOKEN_ENDPOINT'] = `https://${settings.dashboardFqdn()}/openid/token`;
tmp['CLOUDRON_OIDC_KEYS_ENDPOINT'] = `https://${settings.dashboardFqdn()}/openid/jwks`;
tmp['CLOUDRON_OIDC_PROFILE_ENDPOINT'] = `https://${settings.dashboardFqdn()}/openid/me`;
tmp['CLOUDRON_OIDC_LOGOUT_URL'] = `https://${settings.dashboardFqdn()}/openid/session/env`;
tmp['CLOUDRON_OIDC_DISCOVERY_URL'] = `https://${dashboardFqdn}/openid/.well-known/openid-configuration`;
tmp['CLOUDRON_OIDC_ISSUER'] = `https://${dashboardFqdn}/openid`;
tmp['CLOUDRON_OIDC_AUTH_ENDPOINT'] = `https://${dashboardFqdn}/openid/auth`;
tmp['CLOUDRON_OIDC_TOKEN_ENDPOINT'] = `https://${dashboardFqdn}/openid/token`;
tmp['CLOUDRON_OIDC_KEYS_ENDPOINT'] = `https://${dashboardFqdn}/openid/jwks`;
tmp['CLOUDRON_OIDC_PROFILE_ENDPOINT'] = `https://${dashboardFqdn}/openid/me`;
tmp['CLOUDRON_OIDC_LOGOUT_URL'] = `https://${dashboardFqdn}/openid/session/env`;
const client = await oidc.clients.get(app.id);
tmp['CLOUDRON_OIDC_CLIENT_ID'] = client.id;