You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4 KiB

4 years ago
  1. [![Donate](http://www.opensourcecitizen.org/badge)](http://www.opensourcecitizen.org/project?url=github.com/motdotla/dotenv-expand)
  2. If you found this library useful, donate some CPU cycles to this project by clicking above. Thank you! 😇
  3. # dotenv-expand
  4. <img src="https://raw.githubusercontent.com/motdotla/dotenv-expand/master/dotenv-expand.png" alt="dotenv-expand" align="right" />
  5. Dotenv-expand adds variable expansion on top of
  6. [dotenv](http://github.com/motdotla/dotenv). If you find yourself needing to
  7. expand environment variables already existing on your machine, then
  8. dotenv-expand is your tool.
  9. [![BuildStatus](https://img.shields.io/travis/motdotla/dotenv-expand/master.svg?style=flat-square)](https://travis-ci.org/motdotla/dotenv-expand)
  10. [![NPM version](https://img.shields.io/npm/v/dotenv-expand.svg?style=flat-square)](https://www.npmjs.com/package/dotenv-expand)
  11. [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
  12. ## Install
  13. ```bash
  14. npm install dotenv --save
  15. npm install dotenv-expand --save
  16. ```
  17. ## Usage
  18. As early as possible in your application, require dotenv and dotenv-expand, and
  19. wrap dotenv-expand around dotenv.
  20. ```js
  21. var dotenv = require('dotenv')
  22. var dotenvExpand = require('dotenv-expand')
  23. var myEnv = dotenv.config()
  24. dotenvExpand(myEnv)
  25. ```
  26. See [test/.env](./test/.env) for examples of variable expansion in your `.env`
  27. file.