1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00
bitwarden-browser/apps/web/config.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
736 B
JavaScript
Raw Normal View History

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;
}
2021-12-17 15:57:11 +01:00
}
}
module.exports = {
load,
log,
};