Skip to content
Dotenv loader for multiple environments
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.npmignore
.prettierrc
.travis.yml
LICENSE
README.md
index.js
load.js
package.json
yarn.lock

README.md

Build Status Coverage Status

Multienv Loader

A configurable .env file loader for multiple environments inspired by dotenv and vue-cli

Installation

yarn add multienv-loader
npm install multienv-loader

Usage

At the top of your entry file:

require('multienv-loader').load() // or load(options)

Or directly from terminal (without options):

node -r multienv-loader/load your_script.js

Options

  • options.mode: Environment mode. Defaults to process.env.NODE_ENV
  • options.envPath: Location of dotenv files. Defaults to process.cwd()
  • options.envFiles: Array of dotenv filenames to load in order. Defaults to ['.env', '.env.[mode]', '.env.local', '.env.[mode].local']
  • options.dry: Does not modify process.env. Defaults to false
  • options.override: Existing variables in process.env will be overriden by the dotenv files. Defaults to false

Recommended .gitignore

# Local Env Files
.env.local
.env.*.local

Other

Internal functions like parse or safeLoad are also exposed.

License

MIT

You can’t perform that action at this time.