env-params
v1.2.1
Published
env-params is a library dotenv to parametrise using multiple .env file at different path and ecosystems
Downloads
50
Maintainers
Readme
env-params
This is wrapper to use parameterised .env files from customisted folder directory in your process.env object
Installation
npm install env-params
Usage
declare this module on the file you are using
require('env-params').env()
Create a .env
file as per your parameteries data inputs
QA_URL=dev.default-app.com
QA_DB_HOST=localhost
DB_USER=test
DB_PASS=test
Simple! The process.env
is now loaded with the environment variables above.
Example
console.log(process.env.QA_URL)
console.log(process.env.QA_DB_HOST)
console.log(process.env.DB_USER)
console.log(process.env.DB_PASS)
Expected Output
dev.default-app.com
localhost
test
test
If you want to load from a particular environment, use:
// This loads configuration from staging environment
require('env-params').env('QA','path/')