5.1.1 • Published 4 years ago

@chatopera/dotenv v5.1.1

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
4 years ago

dotenv-expand

Dotenv-expand adds variable expansion on top of dotenv. If you find yourself needing to expand environment variables already existing on your machine, then dotenv-expand is your tool.

BuildStatus NPM version js-standard-style

Install

npm install @chatopera/dotenv --save

Usage

Define vars in .env

OTHER_ENV=foo
YOUR_ENV_VAR=$OTHER_ENV/bar

As early as possible in your application, require dotenv and dotenv-expand, and wrap dotenv expand around dotenv.

require('@chatopera/dotenv').config(process.cwd() + '/.env')
process.env["YOUR_ENV_VAR"]

See test/.env for examples of variable expansion in your .env file.