A configurable
.envfile loader for multiple environments inspired by dotenv and vue-cli
yarn add multienv-loadernpm install multienv-loaderAt 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.jsoptions.mode: Environment mode. Defaults toprocess.env.NODE_ENVoptions.envPath: Location of dotenv files. Defaults toprocess.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 modifyprocess.env. Defaults tofalseoptions.override: Existing variables inprocess.envwill be overriden by the dotenv files. Defaults tofalseoptions.filter: Function that gets a variable name as first argument and returns whether or not it should be loaded. Defaults to() => true
# Local Env Files
.env.local
.env.*.local
Internal functions like parse or safeLoad are also exposed.