No description
Find a file
RingOfStorms (Joshua Bell) 5582d09293 initial commit
2020-12-19 16:49:33 -06:00
dist initial commit 2020-12-19 16:49:33 -06:00
node_modules initial commit 2020-12-19 16:49:33 -06:00
src initial commit 2020-12-19 16:49:33 -06:00
package-lock.json initial commit 2020-12-19 16:49:33 -06:00
package.json initial commit 2020-12-19 16:49:33 -06:00
README.md initial commit 2020-12-19 16:49:33 -06:00
tsconfig.build.json initial commit 2020-12-19 16:49:33 -06:00
tsconfig.json initial commit 2020-12-19 16:49:33 -06:00

dotenv-multi

Dotenv-multi is a module that uses dotenv and dotenv-expand to load files similarly to Create React App script's. It allows the use of NODE_ENV and local specific env files.

This is useful because now you can commit your default env files into the repo and still have a sane way to override them locally without having changes in your local git on one .env file.

Install

# with npm
npm install @ringofstorms/dotenv-multi dotenv dotenv-expand

Usage

# js
const dotenvMulti = require('@ringofstorms/dotenv-multi');
dotenvMulti.config();
# typescript
import { config } from '@ringofstorms/multi-env';
config();

Configuring .gitignore

You should add the following to your .gitignore file:

# .env local files
.env.development.local
.env.local
.env.production.local
.env.test.local

What other .env files can be used?