Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nadeesha/env-loader
https://github.com/nadeesha/env-loader
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/nadeesha/env-loader
- Owner: nadeesha
- Created: 2016-05-18T03:42:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-05-18T13:12:21.000Z (over 8 years ago)
- Last Synced: 2024-04-14T07:10:39.180Z (7 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# env-loader
NODE_ENV aware .env loader. Loads the environment variables from a .env file like :fire:.
## Usage
From atop of your app code, (usually as far up as it can be in index.js):
```js
require('env-loader').load();
```Will load `.env` file (see below) from the path that the `.js` file runs in.
But, supposing your process.env.NODE_ENV is `production` and `production.env` is stored in a `.config` dir, just do:
```js
require('env-loader').load({
path: './.config',
});
```## .env file
It's just a key-value file like:
```sh
FOO=BAR # process.env.FOO === BAR
BAZ=BUZZ # process.env.BAZ === BUZZ
```