Socket
Socket
Sign inDemoInstall

now-env

Package Overview
Dependencies
0
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    now-env

Use now.sh environment variables in development


Version published
Weekly downloads
179
decreased by-39.12%
Maintainers
1
Install size
7.02 kB
Created
Weekly downloads
 

Readme

Source

now-env

Module to load environment variables defined in a now.json file or the now key in the package.json and set them in process.env.

Usage

Download it from npm.

yarn add now-env
npm i now-env

Then require it.

require('now-env').config()

That's all, you can now check in process.env for you environment variables!

If your application is running inside ▲ZEIT Now cloud then this module is not going to do anything and let ▲ZEIT Now set your environment variables.

Using secrets

Most probably you will want to use secret keys in your now.json file. This module allow you to use them too without worries in development.

Just create a now-secrets.json file with you development secrets, that file must be ignored with Git, then just use now-env as usual and it will auto-detect the file and use it to replace your secrets values.

If the file doesn't exists or if your secret key is not defined then it's going to use the secret name as value, that means if DB_PASS is @db_pass and you don't define it inside now-secrets.json then the value will be @db_pass.

Migrate from dotenv

If you're already using the dotenv module you can switch to now-env easily.

  1. Create a now.json file with the env key with every environment variable.
  2. Install now-env
  3. Change require('dotenv').config() with require('now-env').config().
  4. That's all!

Keywords

FAQs

Last updated on 26 Aug 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc