yajsonfig

1.0.0 • Public • Published

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"
}

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i yajsonfig

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MPL-2.0

    Last publish

    Collaborators

    • francisco.jordano