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

Support for direnv in iex/mix run configuration #2779

Open
bhuntpenn opened this issue Aug 5, 2022 · 2 comments
Open

Support for direnv in iex/mix run configuration #2779

bhuntpenn opened this issue Aug 5, 2022 · 2 comments

Comments

@bhuntpenn
Copy link

I've opened an issue on the intellij-better-direnv project, given how popular direnv is, would be great if Intellij just made it work but I'm not going to hold my breath waiting for that to happen :-D

Fapiko/intellij-better-direnv#4

@KronicDeth
Copy link
Owner

Weirdly the JetBrains APIs for Run Configurations has support built in for an env file, but it’s not exposed in the UI component 🤷‍♀️

@bhuntpenn
Copy link
Author

bhuntpenn commented Aug 5, 2022

Weirdly the JetBrains APIs for Run Configurations has support built in for an env file, but it’s not exposed in the UI component 🤷‍♀️

Might be slightly different, in order to populate the environment variables the following needs to happen:

  1. IDE (VS Code plugin implementation) invokes direnv export json
  2. Direnv checks to see if the .envrc is in it's list of allowed .envrc files by checking for the file hash in the ~/.local/share/direnv/allow/ directory, for example:
cat ~/.local/share/direnv/allow/252176ea588c4f353333e3c88ffad8310bcdaa8e81b86be21d3ad9b158415a37
/Users/Bryan.Hunt/repos/secrit/.envrc
  1. If direnv finds a matching hash, it evaluates that file (the file can contain commands to in turn evaluate other files.. and takes whatever env vars have changed and outputs JSON to stdout containing all the env vars.

So... just evaluating the .env file isn't sufficient, that's just a thing from older attempts to solve this problem.

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

No branches or pull requests

2 participants