2.2.1 • Published 3 months ago

env-sample v2.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

npm.io

env-sample

npm download GitHub Hits npm.io npm.io

Table of contents

Introduction

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.

CLI Installation

Install

npm install env-sample -g

Usage

$ 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

Package Installation

Installation

npm install env-sample

Usage

default

const envSample = require('env-sample')
envSample()

with option object parameter

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)

Before After Example

Before | Source .env

# 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 ######################################

After | Target .env.sample

# 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

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.

2.2.1

3 months ago

2.1.5

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.3

1 year ago

1.0.7

1 year ago