1.0.0 • Published 9 years ago
yajsonfig v1.0.0
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"
}
1.0.0
9 years ago