-
Notifications
You must be signed in to change notification settings - Fork 621
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 support for .env files #284
Comments
I just discovered Is the
and, if I'm reading the documentation correctly, |
Yes that's correct @jameysharp. There are still two files per project but at least you don't have to duplicate the content between both. |
Thanks @jameysharp for pointing that out! It's not ideal, but it'll have to do! :) On a side note, @zimbatm, since .env files are pretty common, maybe the |
Is there a way to have a Ideally there would also be a way to tell direnv to globally load Looking forward to hearing your thoughts @zimbatm! |
The current execution model of direnv doesn't really allow for that kind of mode. Each of the folders will need that The easiest option right now is to add an alias to your shell: |
It would be nice to be able to use the same .env. Right now I have to create a symlink between them (the ruby dotenv library is able to parse the direnv format). Ideally direnv could handle key=value format without needing to type EXPORT. |
I'd love this too. In the communities I interact with most frequently, .env is more common than .envrc. it would be great if this worked with either. |
I use Edit: Below does not work. I was mistaken... Why put
|
I have created a pull request that adds support for |
I would also like to say, that I'm not sure that the |
@aude the PR is still opening... |
If anyone wishes to have automatic
|
@adamluzsi I can't make it work with your suggestion. Is there anything else needed? |
@felipecrs could you double check if the file is accessable? (~/.config/direnv/direnvrc) Does your .env use .env format or shell envrc format?
Also, try debug by printing you position from the direnvrc config file. Maybe the
#!/bin/sh
pwd > ~/out
if [ -f ".env" ]; then
dotenv
# or if you use shell format:
# source_env ".env"
fi and check the results in ~/out. Best of luck with your investigation! |
@adamluzsi wow, thanks a lot for the tips. I realized that it only works when there is a |
I don't want automatic .env loading. How to opt out the behavior? |
@zimbatm I think you can close this issue. |
I see .env is mentioned in the README and various docs but can't find any reference doc about the actual .env vs. .envrc formats. Could that be noted somewhere in README etc? Is it just something like newline-separated literal variable assignments like |
@dbarnett I think this is what you are looking for .envrc
.env.local
|
But could that be noted somewhere in README etc? I couldn't find any docs, only discussion in random bugs like this. |
I am currently using a tool that only supports the standard .env format (
var=value
), but I would love to be able to use direnv as well. Though, that would require me to have two separate files with the same content in them. One .env and one .envrc. Seems a bit annoying to me.Would it be possible to add support for .env as well? Is there a reason to why this does not exist?
Other than that direnv seems like a really well-written little tool 👍
The text was updated successfully, but these errors were encountered: