0.1.12 • Published 4 months ago

manage-dotenv v0.1.12

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

manage-dotenv

An CLI to manage multiples environnements

How to use

Install

npm install -g manage-dotenv

Create a new environnement

manage-dotenv will copy the content of the designated base environnement file to the new environnement file. It will by default create a new environnement file with the full content of the given file. Can be changes with parameters to clear some variables (with default Regex /PASSWORD|PASS|SECRET|KEY|TOKEN/) or all variable with -a.

manage-dotenv will remove empty lines (with only spaces or tabs) and keep comments.

manage-dotenv create -b <baseEnvToCopy> <envToCreate>

More help with

manage-dotenv create --help

Switch to an environnement

manage-dotenv will copy the content of the designated environnement file to the .env file (can be changes with parameters). It will try to merge a .env.common (can be changes or disabled with parameters) file with the designated environnement file to output the .env file.

manage-dotenv switch <envToSwitch>

More help with

manage-dotenv switch --help

Use case

You have multiples environnements (local, staging, production) and you want to switch between them.

Create .env.local / .env.staging / .env.production (you can use manage-dotenv create) file with your local environnement variables.

ls .

.env.local
.env.staging
.env.production

You can have a .env.common file with common variables between all environnements.

cat .env.common

DEBUG=true

MAIL_HOST=localhost
MAIL_PORT=1025
...

Your app want to read a .env file with your local environnement variables and you want to switch to your staging environnement.

manage-dotenv switch staging

Your .env file will be

cat .env

# Common configuration <path to .env.common>
DEBUG=true
MAIL_HOST=localhost
MAIL_PORT=1025
...

# Environment specific configuration <path to .env.staging>
...

If you want to create a .env without common variables, you can use the -c flag.

manage-dotenv switch -n staging

Your .env file will be

cat .env

# Environment specific configuration <path to .env.staging>
...
0.1.12

4 months ago

0.1.11

4 months ago

0.1.10

4 months ago

0.1.9

4 months ago

0.1.8

4 months ago

0.1.7

4 months ago

0.1.6

4 months ago

0.1.5

4 months ago

0.1.4

4 months ago

0.1.3

4 months ago

0.1.2

4 months ago

0.1.1

4 months ago