New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

env-sample

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-sample

Removes your secret values in '.env' file and generate '.env-sample'. It supports multiline values and protects comments.

latest
Source
npmnpm
Version
2.2.1
Version published
Maintainers
1
Created
Source

env-sample

npm download GitHub Hits

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.

Keywords

env

FAQs

Package last updated on 13 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts