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
Make automatic .env
load an opt-in feature rather than automatic
#880
Comments
Thanks @felipecrs .. that sounds great!! Maybe instead of a global configuration file it would be easier to introduce an environment variable that determines whether |
yea this jumped out as a surprise for me .. I use other tools for working with .env files .. I'd rather not have something as low level as direnv automatically do this .. there is multiple problems with this .. since other tools .. like the dotenv gem for ruby has an override order, and env that comes from "outside" is considered HIGHEST .. so it will lead to incorrect behavior .. |
Sounds good. I already merged #878 that makes it opt-out, but having it opt-in might be better to keep back-compat. |
Thanks for raising this issue @felipecrs . I have similar issue with the newest version. In my case, I use shared
|
maybe a better approach of this is to add syntactic sugar to .envrc that loads .env if present: # the .envrc file
load_dotenv |
This already exist :) |
See https://direnv.net/man/direnv-stdlib.1.html#codedotenv-ltdotenvpathgtcode Alright, so I decided to release v2.30.3 where you can set |
@zimbatm so where can I set edit: found it
|
Please make a new release where an opt-in is required for |
@mrmachine you can opt-out globally so you don't have to downgrade. See my comment before yours. |
You can set in
For projects that you need to load |
As I said, not in the ~/. config folder. I need it to be set in my project folder (git repo), so that all users of that repo doesn't load .env files. |
True, but direnv will try to read |
Got it. In this case we either make The first was already extensively discussed, and it was decided against it. So, I suggest you open a new issue for the second approach. |
OK, will do. Thanks for spending time on this! |
@felipecrs Done: #908 |
By the way, there's no 🤞🏻 for #908 |
Is your feature request related to a problem? Please describe.
So, as the conversation goes on in #845, it turns out to be very obvious that #845 was a breaking change which didn't receive a treatment of such (no major version bump, for example).
Describe the solution you'd like
So, in order to keep 2.x version tree clean, I would suggest we make the automatic
.env
load an opt-in feature, rather than on by default.The user could optionally opt-in by setting a global configuration for direnv (which I'm not sure how that could be achieved, perhaps
~/.direnvrc
?Describe alternatives you've considered
We could simply bump direnv version to 3, but... in fact I think it would be a very welcome addition to let users decide whether they want to use this feature (which is super useful for me) or not (which seems to be breaking some users cases).
Additional context
None.
The text was updated successfully, but these errors were encountered: