Files
threshold-ui/ui/admin/config/environment.js
T

178 lines
5.2 KiB
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
2020-05-18 17:02:09 -04:00
'use strict';
2023-04-03 20:28:31 -07:00
const v8 = require('v8');
const {
defaultEdition,
featureEditions,
licensedFeatures,
} = require('./features');
2020-09-27 14:12:15 -04:00
const APP_NAME = process.env.APP_NAME || 'Boundary';
2020-05-20 11:53:48 -04:00
const API_HOST = process.env.API_HOST || '';
2023-04-03 20:28:31 -07:00
const clone = (obj) => v8.deserialize(v8.serialize(obj));
2020-05-18 17:02:09 -04:00
module.exports = function (environment) {
2023-04-03 20:28:31 -07:00
// Start with a fresh copy of the features config every run, since it
// could be modified by an environment.
const features = {
defaultEdition,
featureEditions: clone(featureEditions),
licensedFeatures: clone(licensedFeatures),
};
2020-05-18 17:02:09 -04:00
let ENV = {
modulePrefix: 'admin',
2020-05-18 17:02:09 -04:00
environment,
rootURL: '/',
2023-01-09 08:48:49 -08:00
locationType: 'history',
2020-05-18 17:02:09 -04:00
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true
},
EXTEND_PROTOTYPES: false,
/*{
// Prevent Ember Data from overriding Date.parse.
Date: false
}*/
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
2020-05-18 17:33:20 -04:00
2020-05-19 18:10:39 -04:00
api: {
host: API_HOST,
2020-05-20 11:14:24 -04:00
namespace: 'v1',
2020-05-19 18:10:39 -04:00
},
appName: APP_NAME,
2020-10-05 17:20:04 -04:00
companyName: 'HashiCorp',
sessionPollingTimeoutSeconds: 300,
2021-01-22 17:01:12 -05:00
oidcPollingTimeoutSeconds: 1,
2020-10-05 16:53:11 -04:00
documentation: {
baseURL: 'https://boundaryproject.io/help/admin-ui',
topics: {
2020-10-06 17:55:19 -04:00
org: '/orgs',
'org.new': '/orgs/new',
project: '/projects',
'project.new': '/projects/new',
account: '/accounts',
'account.new': '/accounts/new',
'auth-method': '/auth-methods',
2021-11-09 10:29:49 -08:00
'managed-groups': '/managed-groups',
2020-10-06 17:55:19 -04:00
group: '/groups',
'group.add-members': '/groups/add-members',
'host-catalog': '/host-catalogs',
'host-catalog.new': '/host-catalogs/new',
2022-02-23 10:50:20 -08:00
'host-catalog.azure': '/dynamic-host-catalogs-on-azure',
'host-catalog.aws': '/dynamic-host-catalogs-on-aws',
2022-09-20 13:23:29 -07:00
'host-catalog.aws.region': '/dynamic-host-catalogs-on-aws-region',
2020-10-06 17:55:19 -04:00
'host-set': '/host-sets',
'host-set.new': '/host-sets/new',
'host-set.add-hosts': '/host-sets/add-hosts',
2023-01-31 16:02:05 -06:00
'host-set.preferred-endpoints': '/host-sets/preferred-endpoints',
'host-set.sync-interval-seconds': '/host-sets/sync-interval-seconds',
2021-07-28 16:27:40 -04:00
'credential-store': '/credential-stores',
'credential-library': '/credential-libraries',
2022-07-26 11:04:01 -05:00
credential: '/credentials',
2020-10-06 17:55:19 -04:00
host: '/hosts',
'host.new': '/hosts/new',
role: '/roles',
'role.add-principals': '/roles/add-principals',
session: '/sessions',
target: '/targets',
'target.new': '/targets/new',
2021-09-21 14:32:39 -04:00
'target.add-host-sources': '/targets/add-host-sets',
'target.enable-session-recording': '/targets/enable-session-recording',
'target.worker-filters': '/targets/worker-filters',
2020-11-16 15:08:59 -05:00
user: '/users',
downloads: '/downloads',
'getting-started.desktop': '/getting-started/desktop',
'api-client.cli': '/api-client/cli',
'api-client.api': '/api-client/api',
worker: '/workers',
2022-08-26 11:50:53 -04:00
'worker.manage-workers': '/workers/manage-workers-on-hcp',
'worker-filters': '/worker-filters',
'storage-bucket': '/storage-buckets',
2020-11-16 15:08:59 -05:00
},
2020-10-05 16:53:11 -04:00
},
2020-11-19 11:47:51 -05:00
'ember-cli-mirage': {
2021-03-05 17:27:00 -05:00
directory: '../../addons/api/mirage',
},
flashMessageDefaults: {
timeout: 4000,
},
2023-04-03 20:28:31 -07:00
features: features,
2023-03-17 14:34:37 -07:00
featureFlags: {},
2020-05-18 17:33:20 -04:00
};
2020-05-18 17:02:09 -04:00
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
2020-05-18 17:33:20 -04:00
ENV['ember-cli-mirage'].enabled = process.env.ENABLE_MIRAGE
? JSON.parse(process.env.ENABLE_MIRAGE)
: true;
2020-05-18 17:33:20 -04:00
ENV['ember-a11y-testing'] = {
componentOptions: {
axeOptions: {
checks: {
2020-05-19 18:10:39 -04:00
'color-contrast': { options: { noScroll: true } },
},
},
},
2020-05-18 17:33:20 -04:00
};
2023-03-17 14:34:37 -07:00
// Default edition in development
2023-04-03 20:28:31 -07:00
ENV.features.defaultEdition = 'enterprise';
// Enable development-only features
ENV.features.featureEditions.oss['dev-edition-toggle'] = true;
ENV.features.featureEditions.enterprise['dev-edition-toggle'] = true;
ENV.features.featureEditions.hcp['dev-edition-toggle'] = true;
// Enable licensed features by default in enterprise and hcp
Object.keys(ENV.features.licensedFeatures).forEach((feature) => {
ENV.features.featureEditions.enterprise[feature] = true;
ENV.features.featureEditions.hcp[feature] = true;
});
2020-05-18 17:02:09 -04:00
}
if (environment === 'test') {
// Testem prefers this...
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
ENV.APP.autoboot = false;
2020-05-18 17:33:20 -04:00
// Notification timeout should be 0 for fast tests
ENV.flashMessageDefaults.timeout = 0;
ENV.enableConfirmService = false;
2020-05-18 17:02:09 -04:00
}
if (environment === 'production') {
// here you can enable a production-specific feature
}
return ENV;
};