EnvFile icon indicating copy to clipboard operation
EnvFile copied to clipboard

Request to add support for .envrc format

Open jeremyk opened this issue 5 years ago • 8 comments

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!

jeremyk avatar Feb 07 '20 18:02 jeremyk

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.

scharf avatar Jun 30 '20 23:06 scharf

.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!

jeyraof avatar Aug 04 '20 08:08 jeyraof

Would love if #117 could get merged :)

steebchen avatar Apr 25 '21 19:04 steebchen

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.

ashald avatar Sep 02 '21 04:09 ashald

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

shinichy avatar Oct 25 '21 06:10 shinichy

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.

deluan avatar Mar 07 '22 04:03 deluan

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.

Dentrax avatar Sep 08 '23 08:09 Dentrax