We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

tkalfigo • 6 years ago

A handy package that complements `dotenv` is `dotenvenc`. It will create an encrypted version `.envenc` from your `.env` that you can place under version control so you can safely share sensitive secrets and passwords with your team.

Dominik Kundel • 6 years ago

Thanks for sharing this :) this is useful!

Alex Groyz • 6 years ago

Hi,do you know what is the scope of application environment variables in nodejs? are scoped only to the running app. for example if pass an environment variable at startup or set an variable in .env fail. can this variable be access outside of my app. I ask this for security reasons.

Dominik Kundel • 6 years ago

Hi Alex! They should only be accessible for that process and any child processes (unless you explicitly pass a different "environment" to the child process on creation). Therefore they should not be accessible outside your app. It's the same as if you would open two terminal windows, write into one `export FOO=bar` and then try to `echo $FOO` in both windows. one will have it defined the other one doesn't.

Johnny Ray • 6 years ago

Check out `good-env` for boolean/number parsing plus default values https://github.com/recursiv...

Dominik Kundel • 6 years ago

Ouh nice! That looks like a useful helper :) Thanks for sharing this!

Oleg Tsyba • 6 years ago

I prefer manage my env vars using docker-compose (using `env_file` directive)

Idris Adetunmbi • 6 years ago

Thanks for this great article, I have had some new learnings.
How can one combine your nodenv module with nodemon?

qiulang • 6 years ago

It is 'if-env NODE_ENV=production &&' NOT '"if-env NODE_ENV=production ??'

Mehmet • 6 years ago

If you are interested to use environment variables as configuration parameters for your libraries you can check a library I wrote: https://github.com/yatki/re...

It's pretty handy.