New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

check-env

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-env

Makes sure that all required environment variables are set.

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
513
increased by11.76%
Maintainers
1
Weekly downloads
 
Created
Source

check-env

CircleCI

Makes sure that all required environment variables are set.

Install

$ npm install --save check-env

Usage

var checkEnv = require('check-env');
checkEnv(['REQUIRED_VAR', 'OTHER_VAR', 'ENV_VAR']);
// => Throws an error if one of the variables aren't set.

CLI Usage

  1. Install as a project dependency as above
  2. Add to a lifecycle script such as prestart
  3. npm start will bail out (exit(1)) with a hard to miss error message if environment variables are not set

Example:

In package.json:

{
  "prestart": "check-env AWS_KEY MONGO_URL",
  "start": "node index.js"
}
$ echo $MONGO_URL
# (nothing)

$ npm start
 ________________________________________
< Missing environment variable MONGO_URL >
 ----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

$ echo $?
1

FAQs

Package last updated on 09 Jun 2017

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc