env-config-replace

1.0.2 • Public • Published

env-config-replace

Use env variables to replace default configuration Simply replace your config file with the env variables

Install

npm install env-config-replace

Getting Start

Just require the package and use it as a function to parse your config file

test.json

{
    "foo":4000,
    "bar":{
        "x":true,
        "y":"false"
    },
    "haa":"test"
}

test.js

var envReplace = require('env-config-replace')
var config = require('./test.json')
envReplace(config)
console.log(config)

Use command line to set your env and start the node script

FOO=6000 BAR_X=false BAR_Y=TRUE node test.js

You will get such result

{ foo: 6000, bar: { x: false, y: 'TRUE' }, haa: 'test' }

Readme

Keywords

Package Sidebar

Install

npm i env-config-replace

Weekly Downloads

117

Version

1.0.2

License

MIT

Last publish

Collaborators

  • as93717913