ENVDOTJSON
ENVDOTJSON is a module loads environment variable from a single json
file into process.env
.
Installation
$ npm i envdotjson
Usage
Require envdotjson
as early as possible in your app, and load the environment variables
;
Create a env.json
file in your root directory, with the following format
NOTE: variables in default
will gets loaded in any environment stages
BUT, you can overwrite it in any environment stage
In order to get process.env.DB_NAME === "user-test"
, you need to set the NODE_ENV=tst
first, for example:
$ NODE_ENV=tst node index.js
set the NODE_ENV
in your env.json
file will not work.
License
MIT