@chatopera/dotenv
v5.1.1
Published
Expand environment variables using dotenv
Downloads
3
Readme
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.
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.