mirror of https://github.com/bitwarden/web.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
675 B
32 lines
675 B
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 |
|
};
|
|
|