Socket
Socket
Sign inDemoInstall

dotenv-json

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dotenv-json

Load environment variables via a JSON file


Version published
Weekly downloads
33K
increased by5.1%
Maintainers
1
Install size
3.73 kB
Created
Weekly downloads
 

Readme

Source

dotenv-json

Load environment variables via a JSON file

npm install dotenv-json

Define your environment variables in .env.json in the root of your project (or wherever you start your node process):

{
  "public_api_key": "s@Mpl3_d@Ta"
}

Load your environment variables at the beginning of your program:

require("dotenv-json")();

console.log(process.env.public_api_key) // => s@Mpl3_d@Ta

N.B. Existing keys in process.env will not be overwritten.

You can customize the location of your .env.json file by passing a path option:

const dotenvJSON = require("dotenv-json");
dotenvJSON({ path: "./config/example.json"});

Keywords

FAQs

Last updated on 27 Sep 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