DotEnv for Node.js
DotEnv loads environment variables from .env into your ENV.
Installation
As early as possible in your application require dotenv and load the .env variables.
DotEnv = ;;
Usage
Add your application configuration to a .env
file in the root of your project:
S3_BUCKET=YOURS3BUCKETSECRET_KEY=YOURSECRETKEYGOESHERE
When your application loads, these variables will be available via process.env
:
processenvS3_BUCKET;processenvSECRET_KEY;
Inspiration
- The Twelve Factor App
bkeepers/dotenv
- the original, written in Ruby - https://github.com/bkeepers/dotenvscottmotte/dotenv
- the first take on this, written in JavaScript - https://github.com/scottmotte/dotenv
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Running tests
npm installnpm test