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

Add direnv .envrc to python gitignore #3619

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

fslds
Copy link

@fslds fslds commented Jan 7, 2021

Reasons for making this change:

The direnv project (https://direnv.net/ ) uses .envrc files for dynamically loading environment variables (or other settings) per directory using the user's shell... As it can contain sensitive information, and is similar in goal as to dotenv etc, I think it is a good idea to exclude this by default as well into popular languages that already can use a 'dotenv' .env file as well. Adding this to the python .gitignore.

Links to documentation supporting these rule changes:

The direnv project (https://direnv.net/ )  uses .envrc files for dynamically loading environment variables (or other settings) per directory using the user's shell.. As it can contain sensitive information, and is similar in goal as to .env etc, I think it is a good idea to exclude this by default as well.
@garrison
Copy link

One might want to intentionally add an .envrc file to the repository, e.g., one that includes the single line layout python3. In this case, .direnv should be added to .gitignore, but .envrc shouldn't be.

In fact, it is safe to exclude .direnv in all cases. I came here to submit a pull request that adds .direnv to .gitignore for python (really it could be added for every single language). But I don't believe that .envrc should be added.

@garrison
Copy link

In other words, while .envrc can contain secrets, that is not the sole purpose of direnv.

@fslds
Copy link
Author

fslds commented Dec 5, 2021

That is actually correct, but the likelihood is large that a secret ends up in the .envrc file, and this is an effort to increase overall security.
By adding it to the general .gitignore, - and yes it should be added for each language - it needs to be uncommented explicitly, making it a conscious action...
That being said I would recommend using the dotenv command or source .env in .envrc and store secrets in the more commonly used .env.
I switched to that workflow myself in the meanwhile 😇 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants