yajsonfig
v1.0.0
Published
(Yet another ) Simple configuration via json files and environment variables
Downloads
3
Readme
yajsonfig
Jet Another simple json configuration package for your projects.
Usage
const config = require('yajsonfig')(__dirname + '/config.json');
console.log('My configuration is ', config);
Extras
Not many.
You can overwrite the values of the json file based on environment variables.
For example, given the following json file:
{
"port": 3000,
"directory": "/tmp/var"
}
Setup the environment variable SIMPLECONFIG
to a prefix of your choice:
export SIMPLECONFIG='MY_PROJECT_'
And then setup as many variables as you want:
export MY_PROJECT_directory=/tmp/another
Your config object will come like:
{
"port": 3000,
"directory": "/tmp/another"
}