mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-31 08:20:37 +01:00
66bd8be2c9
* 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
33 lines
675 B
JavaScript
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
|
|
};
|