@eddiewen/dotenvjson
Version:
Loads environment variables from .json file
25 lines (18 loc) • 456 B
JavaScript
const path = require('path');
const appConfig = {
path: path.join(process.cwd(), '.env.json'),
inUpperCase: true,
};
const loadConfig = (options) => {
if (!options || Object.values(options).length === 0) {
return appConfig;
}
Object.keys(appConfig).forEach((property) => {
if (!Object.hasOwnProperty.call(options, property)) {
return;
}
appConfig[property] = options[property];
});
return appConfig;
};
module.exports = loadConfig;