bkeepers / dotenv

A Ruby gem to load environment variables from `.env`.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README is not clear about using the gem in production

x-yuri opened this issue · comments

And then people tell me, it's bad to put environment variables into .env in production, can you put them into ~/.bashrc? Like .bashrc was ever meant for environment variables.

Why don't we elaborate, so that people understand what's wrong about it? For example,

What's wrong with using dotenv in production?

When environment variables are put into .env file, they are not automatically available when you ssh into your server. You might say, I can source the file from ~/.profile, or ~/.bash_profile. But then the following doesn't work:

ssh user@host set | grep MY_VARIABLE

But, you can do:

ssh user@host bash -lc set | grep MY_VARIABLE

Whether this is an issue, it's up to you to decide. But you can put them into /etc/environment and be done with it (works in all the use cases above).

In case of cloud services like Heroku, they have APIs specifically targeting this use case (adding environment variables).

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.