How to use .env or .envrc files to pull env vars for run/debug configurations?

Answered

I think this is a topic in general for Jetbrains IDEs (I use Webstorm and Goland). I have projects in either those using .env files with 20 variables. Then if I want to create a run/debug configuration, I need to add these 20 variables in the "Environment variables" section with their values. Isn't there a way to tell the run/debug configuration to obtain the env vars from my .env or .envrc instead? If I want to update a variable I have to do it in both places, as sometimes I run the code outside of the IDE.

1
6 comments

Hello,

Please try out EnvFile plugin.

1

I installed EnvFile in IntelliJ Ultimate, but now I cannot find in IntelliJ Settings where to configure the plugin. They only provide a screen shot for PyCharm on the plugin homepage.

0

John Bonfardeci, you can find it via Run | Edit Configurations | [Created Configuration] | EnvFile tab.

1

Hi,

Has JetBrans team to implement use .env be default and/or without any plugins?

Thank you.

1

Hi Ildar,

I'm afraid not supported yet. Please follow this task to track any updates on the matter, should some come up - IDEA-289940

0

It's not clear what IDEA-289940 is about. The correct issue for the feature is https://youtrack.jetbrains.com/issue/IDEA-205637/Run-configurations-Add-ability-to-specify-a-file-that-defines-environment-variables-.env-.yml-etc. it's about finally implementing it again in core after it has been implemented for some IntellIj products, but also not for some. 

So, the feature might be available natively or with Plugins for you product or not. Or the plugin should work, but doesn't, you know the daily business. Don't waste too much time on searching for the feature, trying tips for unrelated plugins or workaround, as long the issue is not implemented - like I did for this and so many other missing IntelliJ features.

Sometimes I wonder what the IntelliJ devs use to develop software…

0

Please sign in to leave a comment.