dotenv-vars
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -9,6 +9,6 @@ var fs = require('fs'), | ||
envArray.forEach(function(envKeyVal) { | ||
var key = envKeyVal.split('=')[0], | ||
val = envKeyVal.split('=')[1]; | ||
var key = envKeyVal.split('=')[0].trim(), | ||
val = envKeyVal.split('=')[1].trim(); | ||
process.env[key] = val; | ||
}, this); |
{ | ||
"name": "dotenv-vars", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "The slimmest module to load a .env file in your project path, setting each row in environment variables.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -11,2 +11,18 @@ dotenv-loader | ||
- Put a **.env** file in your project root containing one pair of environment variable on each row like ``` NODE_ENV=debug ``` | ||
- In the top of your main file put ``` require('dotenv-vars') ``` | ||
- In the top of your main file put ``` require('dotenv-vars') ``` | ||
## Example | ||
### .env | ||
``` | ||
NODE_ENV=debug | ||
PORT=3000 | ||
``` | ||
### index.js | ||
```javascript | ||
require('dotenv-vars'); | ||
console.log('process.env.PORT'); | ||
``` | ||
Prints: ```3000``` |
1397
27