Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curious: why commit .env files? #2403

Closed
jliebrand opened this issue May 29, 2017 · 4 comments
Closed

Curious: why commit .env files? #2403

jliebrand opened this issue May 29, 2017 · 4 comments

Comments

@jliebrand
Copy link

Your readme states that .env files SHOULD be checked in to source control, but .env*.local should not. That seem counter to what the dotenv module (or anyone else) recommends.

I'm just curious: why would you ever commit a .env file that contains secrets??

(this doesn't block me; I can and will just use .env.local and ignore .env files, but just thought it was an odd recommendation)

@gaearon
Copy link
Contributor

gaearon commented May 29, 2017

Because dotenv README is about usage on the server. But on the client all embedded values will be part of client bundle anyway. So those cannot be real "secrets" anyway. Committing these values is more convenient in this case.

@gaearon gaearon closed this as completed May 29, 2017
@patoncrispy
Copy link

Thanks for the explanation @gaearon. It seems so obvious when I stop and think about it. :)

@daniel-lovell
Copy link

daniel-lovell commented Dec 23, 2017

@gaearon I'm confused. I just set up a new create-react-app with a .env file. The only values that are included in the bundle are the ones with keys that start with REACT_APP_
None of the other values are included in the front end bundle. It appears that these values could still be considered "secret."

Are you suggesting that real secrets shouldn't be included in .env so that .env can be committed for the convenience of sharing REACT_APP_ values? If REACT_APP_ values aren't environment dependent or aren't secret, why put them in .env at all?

@jesslyoung
Copy link

It depends on your app. A custom build step, non-public asset, or npm script could all utilize .env for secrets.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants