No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.babelrc
.gitignore
.npmignore
README.md
index.js
logger.js
package.json

README.md

env-loader

NODE_ENV aware .env loader. Loads the environment variables from a .env file like 🔥.

Usage

From atop of your app code, (usually as far up as it can be in index.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:

require('env-loader').load({
    path: './.config',
});

.env file

It's just a key-value file like:

FOO=BAR     # process.env.FOO === BAR
BAZ=BUZZ    # process.env.BAZ === BUZZ