Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@sk39/dotenv-ex

1.0.1 • Public • Published

dotenv-ex

Dotenv extension. Switch settings with NODE_ENV.

NPM

Install

npm install @sk39/dotenv-ex

Usage

As early as possible in your application, require and configure dotenv.

require('@sk39/dotenv-ex').config()

Create a .env file in the root directory of your project. Add environment-specific variables on new lines in the form of NAME=VALUE. For example:

DEBUG=true
SERVER_URL="http://127.0.0.1:3000/"
NUMBER_FLAG=0
FLOAT_FLAG=0.0034

further. You can overwrite the NODE_ENV specific settings by creating a .env.{NODE_ENV} file.

process.env now has the keys and values you defined in your .env file.

const env = require("dotenv-ex").config();
console.log(process.env.SERVER_URL)

Install

npm i @sk39/dotenv-ex

DownloadsWeekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

6.02 kB

Total Files

9

Last publish

Collaborators

  • avatar