Skip to content

process.env #81

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

Closed
DanielRuf opened this issue Sep 25, 2018 · 7 comments
Closed

process.env #81

DanielRuf opened this issue Sep 25, 2018 · 7 comments

Comments

@DanielRuf
Copy link

Issue

Description

Using process.env is not great as the used env variables seem to be not declared anywhere. We should use cross-env for testing purposes and use some config for setting them instead of using process.env.

@linux-nerd
Copy link

@DanielRuf Thanks for pointing it out. I added .env files with the variables as part of #57, and I think I missed to commit it.
I will raise a PR against this issue.

@linux-nerd
Copy link

Ahh! Now I see why I missed to add .env file. @crysfel, @emmawedekind I think we can remove .env file from .gitignore. It makes sense to ignore .env.local or.env.* but not .env file. If the developer has to change the value of .env file, hr/she can create .env.local file and make changes. Thoughts?

@emmabostian
Copy link
Collaborator

I think that's fine! I have approved the PR.

@ghost
Copy link

ghost commented Sep 27, 2018

When I started the Google Analytics PR #70, I also included setting up .env for the tracking ID. It might have been a good idea for me to have started a separate issue. I'll leave the .env stuff to @linux-nerd and focus on getting the GA PR done.

@ghost ghost mentioned this issue Sep 28, 2018
@crysfel
Copy link
Member

crysfel commented Sep 28, 2018

I'm wondering if dotenv supports .env.local to overwrite the values from .env. As far as I know CRA internally uses dotenv to load data to the process.env object.

@charlesjliu
Copy link

I don't think we should have a .env committed into the repo.

https://www.npmjs.com/package/dotenv#should-i-commit-my-env-file

Is there a reason why those links are set using environment variables (slack etc.)? I don't think those should be set by the environment.

If anything, you could set default values if the environment variables aren't detected. We can have a sample .env file that developers can use to write their own and include instructions in the repo. But environment variables should be for things like... the CODING_COACH_API url, or whatever client API keys we're using (like the Google Analytics example).

Just my two cents! 🤷‍♂️

@DanielRuf
Copy link
Author

Exactly. dot-env are normally meant for credentials and user specific settings.

@linux-nerd linux-nerd mentioned this issue Oct 7, 2018
5 tasks
@crysfel crysfel closed this as completed Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants