Socket
Socket
Sign inDemoInstall

env-loader

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    env-loader

Environment loader for node.js applications


Version published
Maintainers
1
Install size
6.40 kB
Created

Readme

Source

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):

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

Keywords

FAQs

Last updated on 18 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc