Dotenv libraries are supported by the community.

Special thanks to:

Warp
Warp is a blazingly fast, Rust-based terminal reimagined to work like a modern app.
Get more done in the CLI with real text editing, block-based output, and AI command search.

Retool
Retool helps developers build custom internal software, like CRUD apps and admin panels, really fast.
Build UIs visually with flexible components, connect to any data source, and write business logic in JavaScript.

WorkOS
Your App, Enterprise Ready.
Add Single Sign-On, Multi-Factor Auth, and more, in minutes instead of months.





[![dotenv-vault](https://badge.dotenv.org/works-with.svg?r=1)](https://www.dotenv.org/r/github.com/dotenv-org/dotenv-vault?r=1) # dotenv-expand dotenv-expand Dotenv-expand adds variable expansion on top of [dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to expand environment variables already existing on your machine, then dotenv-expand is your tool. [![BuildStatus](https://img.shields.io/travis/motdotla/dotenv-expand/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv-expand) [![NPM version](https://img.shields.io/npm/v/dotenv-expand.svg?style=flat-square)](https://www.npmjs.com/package/dotenv-expand) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) [![Featured on Openbase](https://badges.openbase.com/js/featured/dotenv-expand.svg?token=BGZJQVRDGu24cWu/F8LIrCmZvIhC1yUc03IUkk9/sUM=)](https://openbase.com/js/dotenv-expand?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge) ## Install ```bash # Install locally (recommended) npm install dotenv-expand --save ``` Or installing with yarn? `yarn add dotenv-expand` ## Usage Create a `.env` file in the root of your project: ```dosini PASSWORD="s1mpl3" DB_PASS=$PASSWORD ``` As early as possible in your application, import and configure dotenv and then expand dotenv: ```javascript var dotenv = require('dotenv') var dotenvExpand = require('dotenv-expand') var myEnv = dotenv.config() dotenvExpand.expand(myEnv) console.log(process.env) ``` That's it. `process.env` now has the expanded keys and values you defined in your `.env` file. ### Preload You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#cli_r_require_module) to preload dotenv & dotenv-expand. By doing this, you do not need to require and load dotenv or dotenv-expand in your application code. This is the preferred approach when using `import` instead of `require`. ```bash $ node -r dotenv-expand/config your_script.js ``` The configuration options below are supported as command line arguments in the format `dotenv_config_