Removes your secret values in .env
file and generates .env.sample
or .env.dev
or .env.test
etc. file.
Supports multiline values (for example: RSA PRIVATE KEY) and protects your comments.
npm install env-sample -g
$ env-sample -h
Usage: env-sample [options]
Options:
-e, --env Source file. default is ".env"
-s, --sample Target file. default ".env-sample"
-m, --mask Mask character. example: "*", " ", etc.
default is "" (empty string)
-b, --banner Set your banner to bottom of target.
--banner="" Remove default banner.
-w, --watch Watch source file. If the source file is deleted,
the target file is also deleted.
-v, --version output the version number
-h, --help output usage information
npm install env-sample
const envSample = require('env-sample')
envSample()
const envSample = require('env-sample')
const options={
env: '.env',
sample: '.env-sample',
mask: '',
watch: false,
banner:`2023-Now (c) MiaJupiter. All rights reserved. https://miajupiter.com`
}
envSample(options)
# jwt variables
TOKEN_EXPIRES_IN=31536022 # valid for 1 year
TOKEN_PHRASE=upper520World
# MongoDB variables
# password special chars --> : / ? # [ ] @
# they must replace with uri equavalents :=%3A /=%2F ?=%3F #=%23 [=%5B ]=%5D @=%40
# mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
MONGODB_MAINDB_URI=mongodb://localhost:27017/restApi
MONGODB_USERDB_URI='mongodb://localhost:27017/' # user database server
# Enable debug mode (true) or disable it (false).
DEBUG=false
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
...
crt ys 319612719849...589317318614
Kh9NV...
...
-----END RSA PRIVATE KEY-----" # Make this variable too, let's see!
MY_NAME=shamanCoders
USER_ID=319817318 # for all mankind
TEST=4445
########################## TEST 7 7 7 ######################################
# jwt variables
TOKEN_EXPIRES_IN= # valid for 1 year
TOKEN_PHRASE=
# MongoDB variables
# password special chars --> : / ? # [ ] @
# they must replace with uri equavalents :=%3A /=%2F ?=%3F #=%23 [=%5B ]=%5D @=%40
# mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
MONGODB_MAINDB_URI=
MONGODB_USERDB_URI= # user database server
# Enable debug mode (true) or disable it (false).
DEBUG=false
PRIVATE_KEY= # Make this variable too, let's see!
MY_NAME=
USER_ID= # for all mankind
TEST=
########################## TEST 7 7 7 ######################################
# --------------------------------------------------------------------
# 2023-Now (c) MiaJupiter. All rights reserved. https://miajupiter.com
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.