Socket
Book a DemoInstallSign in
Socket

envar-cli

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

envar-cli

Manage your .env variable using ligthweight cli. You can add, update, remove or list your environment variables.

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

envar-cli

Getting Started

envar-cli is lightweight global package for managing .env variables using cli. You can add, update, remove or list environment variables.

💻Install

# with npm
npm install -g envar-cli

📒Usage

Open your terminal on project folder and check the below instructions. To get help please write envar-cli --help on terminal.

Specify The .env File Extension

There are several .env file extension. Default file is .env for envar-cli.

envar-cli supports:

  • .env
  • .env.example
  • .env.local
  • .env.dev
  • .env.development
  • .env.prod
  • .env.production
  • .env.staging
  • .env.preview

Please specify the extension end of the command with --[fileSpecifier]

Select The File Extension

envar-cli [command] [value] [extension]


# Select .env (do not write anything)

#.env is default. No need to write anything.


# .env.example
envar-cli [command] [value] --example


# .env.local
envar-cli [command] [value] --local


# .env.dev
envar-cli [command] [value] --dev


# .env.development
envar-cli [command] [value] --development


# .env.prod
envar-cli [command] [value] --prod


# .env.production
envar-cli [command] [value] --production


# .env.staging
envar-cli [command] [value] --staging


# .env.preview
envar-cli [command] [value] --preview

Add Variable

If .env file is not exists envar-cli will create a blank .env file.

envar-cli add "PORT=9000"

# or
envar-cli add PORT=9000


#with specific .env file --[extension]
envar-cli add PORT=3000 --dev
envar-cli add PORT=8080 --prod

Result:

.env:

PORT=9000

.env.dev:

PORT=3000

.env.prod:

PORT=8080

Add Variable With Comment

If you want to add a comment to your .env file, please use --comment option. It will be add your comment line before the variable. Currently, it works only if variable is newly added.

envar-cli add "SECRET_KEY=github" --comment "# SECRET KEYS"

#or

#with specific .env file --[extension]
envar-cli add "SECRET_KEY=google" --comment "# SECRET KEYS" --prod

Result:

.env:

# SECRET KEYS
SECRET_KEY=github

.env.prod:

# SECRET KEYS
SECRET_KEY=google

Update Variable

To update a variable you can use update command.

envar-cli update SECRET_KEY=github

#or
envar-cli update "SECRET_KEY=github"


#with specific .env file --[extension]
envar-cli update SECRET_KEY=github --prod

If variable not exists you will see a message like this: ❗: <MY_VAR> not found in .env

Remove Variable

Deleting is also simple. Just use remove, del or delete command. And please:

  • Write only variable name not with value.
  • Pay attention to case sensitivity
envar-cli remove SECRET_KEY

#or
envar-cli del "SECRET_KEY"


#with specific .env file --[extension]
envar-cli delete SECRET_KEY --staging

List Variables

To count and see your environment values please use list command.

envar-cli list


#with specific .env file --[extension]
envar-cli list --development

Example Result:

1. PORT=8080
2. SECRET_KEY=github
📄  : 2 variables found in .env

FAQs

Package last updated on 01 Jul 2021

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.