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 feature to automatically pick .env file(s) from project_root directory #31

Open
mtahirtariq opened this issue Mar 20, 2017 · 7 comments
Labels

Comments

@mtahirtariq
Copy link

Thanks for this awesome project, it solved a lot of issues with env management for me :).
I believe it would be awesome to add a feature (may be disabled by default) which when enabled make EnvFile to automatically load .env file(s) from project_root.
So that we enable this feature and we don't need to add .env files in run configuration for each project we just place the .env file in project_root and it will automatically be loaded.

@ashald
Copy link
Owner

ashald commented May 1, 2017

At the first glance this sounds as a cool idea but on a 2nd thought I'm wondering whether this is really a good thing to do. After all, there are too many questions and unclarity. What if there are several .env files? It might be non-intuitive where variables are coming from and so on. I believe you can try to achieve similar functionality by editing the run configuration template you use. If that sounds good for you please give it a try and let me know how it worked.

@ashald
Copy link
Owner

ashald commented Mar 10, 2018

Any feedback on proposed workaround with run configuration templates?

@iddan
Copy link

iddan commented May 16, 2018

The common practice is to only load a file with the exact name .env. Other .env files should be consumed explicitly

@ashald
Copy link
Owner

ashald commented May 22, 2018

Does the workaround proposed here works to enable the desired behavior #55 (comment) ?

@iddan
Copy link

iddan commented May 22, 2018

Yeah, it's more of a matter of defaults.

@aotd1
Copy link

aotd1 commented May 30, 2018

It can be achieved using the IDE notification dialog.
If .env file exists in project, plugin can propose popup dialog to automatically add it in all / specific run configuration (s).

@devurandom
Copy link

I believe you can try to achieve similar functionality by editing the run configuration template you use. If that sounds good for you please give it a try and let me know how it worked.

Thanks for the hint! I tried it (https://www.jetbrains.com/help/idea/run-debug-configuration.html#templates explains where to find the config) and it works very well. I especially like that (after you have figured out how to do it) it is very obvious which variables from which files are loaded where -- no automagic. :)

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

No branches or pull requests

5 participants