prop-env
Getter and Setter 'process.env' variable from '.env' file
Install
$ npm install --save prop-env
Usage
├── .env
├── index.js
└── package.json
// '.env' file
TWITTER_CONSUMER_KEY=gNiRPbQNG
TWITTER_CONSUMER_SECRET=95tpBUhR
const env = ; console;//=> 'gNiRPbQNG' console;//=> '95tpBUhR' // set default valueconsole;//=> undefined console//=> 'Umst0AZIiwex36' console;//=> 'Umst0AZIiwex36' console;//=> undefined console;//=> 'LxU9qi9hAe' // Can not override the valueconsole;//=> 'LxU9qi9hAe' console;//=> 'LxU9qi9hAe' console;/*{ // ... "TWITTER_CONSUMER_KEY": "gNiRPbQNG", "TWITTER_CONSUMER_SECRET": "95tpBUhR", "TWITTER_TOKEN_KEY": "Umst0AZIiwex36", "TWITTER_TOKEN_SECRET": "LxU9qi9hAe", // ...}*/
API
env(key, value, envFile)
Returns string
value of process.env key
key
Type: string
process.env key
value
Set env value
envFile
Type: string
Default: process.cwd() + '/.env'
Set env path
License
MIT © Guntur Poetra