env-save
v1.0.8
Published
Save a variable into .env file with protecting your other comments and variables
Downloads
3
Maintainers
Readme
env-save
Table of contents
- Introduction
- CLI Installation
- Package Installation
- Protecting ENV comments and structure
- License - MIT License
Introduction
Save a variable into .env
file with protect your other comments and variables
CLI Installation
Install
npm install env-save -g
Usage
$ env-save -h
Usage:
env-save [options] --VARIABLENAME=value [--VARIABLENAME2=value2 ...]
Options:
--VARIABLENAME=value Set .env variable
-e, --env Source file. default is ".env"
-v, --version Show the version number
-h, --help Show usage information
Examples:
env-save --NODE_ENV=production
env-save --PORT=3000 --USER=root --PASSWD=root --ENV=production
# We can also use these parameters "ENV", "VERSION" and "HELP"
# but not lowercase
env-save --VERSION=1.0.1 --ENV=production
Multiline Example: new line char: \n
env-save --PRIVATEKEY="---BEGIN RSA---\n...\nKh9NV\n-----END RSA---"
Package Installation
Installation
npm install env-save
Usage
const envSave = require('env-save')
envSave('MONGODB_URI','mongodb://localhost:27017/')
envSave('TOKEN','fdffd545fdggferdertrt')
envSave('DEBUG',true)
envSave('PORT',3000)
Protecting ENV comments and structure
Before .env file
MY_NAME=shamanCoders
USER_ID=319817318 # for all mankind
TEST=4445
...
env-save --USER_ID=40015
After env-save
MY_NAME=shamanCoders
USER_ID=40015 # for all mankind
TEST=4445
...
License - MIT License
Copyright (c) 2023-Now MiaJupiter Technology Inc.. All rights reserved. We are proud to be Open Source. For full details about the license, please check the LICENSE
file in the root directory of the source repository.