1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-08-29 23:49:50 +02:00
bitwarden-browser/config.js
Matt Gibson 66bd8be2c9
Set urls from config file (#1151)
* Set environment URLs in webpack config.

* Provide non NULL dev server

* QA env uses the pq TLD

* Include icons in qa env

* Move base configs to develop.

local configurations should be done in the `./config/local.json` file.

* Fix config override loading to default to development

* Standardize url formatting

* Limit QA settings to those set in production

* Set self hosted in a config

* Specify cloud instead of production

Self hosted and cloud are both production environments.
The ENV setting is used to specify the env type while
NODE_ENV specifies whether development error handling and services.

* Update config instructions

* Remove invalid json

* Change env `production` references to `cloud`

* Fix formatting
2021-08-25 13:15:31 -05:00

33 lines
675 B
JavaScript

function load(envName) {
return {
...require('./config/base.json'),
...loadConfig(envName),
...loadConfig('local'),
};
}
function log(configObj) {
const repeatNum = 50;
console.log(`${"=".repeat(repeatNum)}\nenvConfig`);
console.log(JSON.stringify(configObj, null, 2));
console.log(`${"=".repeat(repeatNum)}`);
}
function loadConfig(configName) {
try {
return require(`./config/${configName}.json`);
} catch (e) {
if (e instanceof Error && e.code === "MODULE_NOT_FOUND") {
return {};
}
else {
throw e;
}
}
}
module.exports = {
load,
log
};