1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-05 09:10:53 +01:00
bitwarden-browser/config.js
Matt Gibson 6d4f163824
Update local web development instructions (#1208)
* Indicate production with NODE_ENV

* Use local.json config to point to Bitwarden production APIs

* Add proxy configuration to cloud and qa environment

* Move notifications to urls

Co-authored-by: Hinton <oscar@oscarhinton.com>
2021-10-22 07:50:08 -05:00

38 lines
831 B
JavaScript

function load(envName) {
return {
...require('./config/base.json'),
...loadConfig(envName),
...loadConfig('local'),
dev: {
...require('./config/base.json').dev,
...loadConfig(envName).dev,
...loadConfig('local').dev,
},
};
}
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
};