mirror of
https://github.com/bitwarden/browser.git
synced 2024-08-22 22:32:57 +02:00
31 lines
561 B
JavaScript
31 lines
561 B
JavaScript
|
function load(envName) {
|
||
|
return {
|
||
|
...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(`./${configName}.json`);
|
||
|
} catch (e) {
|
||
|
if (e instanceof Error && e.code === "MODULE_NOT_FOUND") {
|
||
|
return {};
|
||
|
} else {
|
||
|
throw e;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
load,
|
||
|
log,
|
||
|
};
|