ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
539 stars 129 forks source link

Request to add support for .envrc format #102

Open jeremyk opened 4 years ago

jeremyk commented 4 years ago

We are using https://direnv.net/ to share a base config and it works really well for that. Would be even better if we could reference the same file in our run configs.

Format is pretty simple:

export DB_NAME=abc export DB_HOSTNAME=www.hosts.com export DB_PORT=3333

Thanks!

scharf commented 4 years ago

It seems that this is pretty much the same as an .env file but ignoring/removing export strings at the beginning of a line?

That way, a shell script could source the .env file and sets the exports and this plugin can use it directly.

jeyraof commented 4 years ago

.envrc for direnv is bash script compatible. So $ source .envrc is corect way to apply it. I also think adding .envrc type support is very valuable!

steebchen commented 3 years ago

Would love if #117 could get merged :)

ashald commented 3 years ago

I have no intention on merging #117 as it is right now.

I'm considering whether I'd agree to merge it if #117 included a feature toggle. That being said, it sounds like the right way to handle this is to add support for a new format type which would execute a given executable in a shell and then read the environment variables from it. Would welcome such contribution.

shinichy commented 2 years ago

@ashald I implemented this functionality in the way you suggested. Would you review https://github.com/ashald/EnvFile/pull/160? Thanks!

deluan commented 2 years ago

While we don't have @shinichy's PR merged, my current workaround is to change the syntax of the .envrc file to:

DB_NAME=abc
DB_HOSTNAME=www.hosts.com
DB_PORT=3333

export DB_NAME DB_HOSTNAME DB_PORT

That way both direnv and EnvFile can load the file correctly.

Dentrax commented 1 year ago

As a fresh user of this plugin, I hit this issue. Any updates on this? @ashald It seems #160 is closed for some reason.

I was about to adopt EnvFile but this is making me reconsider.