dotenv-modern

0.1.1 • Public • Published

dotenv-modern

dotenv-modern is more agile loader for multiple .env file for your projects, build on top of dotenv and dotenv-expand

Install

npm:

npm i dotenv-modern

Yarn:

yarn add dotenv-modern

pnpm:

pnpm i dotenv-modern

Usage

dotenv-modern is a 100% substitute to dotenv and dotenv-expand (cause it's build on top)

- require('dotenv').config()
+ require('dotenv-modern').config()
console.log(process.env) // remove this after you've confirmed it is working

or ES6

- import * as dotenv from 'dotenv'
+ import * as dotenv from 'dotenv-modern'
dotenv.config()
// All dependant imports, that rely on environment variable have to be placed AFTER loading dotenv config

import express from 'express'

Dotenv files hierarchy

Filename Reccommended to .gitignore
.env.${NODE_ENV}.local Yes
.env.local Yes
.env.${NODE_ENV} No
.env No

Production build order: .env.production.local, .env.local, .env.production, .env

Development run: .env.development.local, .env.local, .env.development, .env

Running tests: .env.development.local, .env.development, .env

Readme

Keywords

Package Sidebar

Install

npm i dotenv-modern

Weekly Downloads

1,161

Version

0.1.1

License

MIT

Unpacked Size

3.72 kB

Total Files

3

Last publish

Collaborators

  • leon0399