5 comments

[ 4.0 ms ] story [ 24.7 ms ] thread
I’m not sure from the readme how this compares to direnv which seems to do the same thing.
Just had a quick look at both. Here's what I found:

direnv * looks for a .envrc file * starts a subshell * loads environment variables into the subshell from the .envrc file

autoenv * looks for a .env file * executes commands from that file in the current shell * allows cleanup via a .env.leave file

This seems quite an unfortunate state of affairs to me because: * my .env files usually just contain environment variable declarations * a .envrc seems much more non-standard and based on the name alone I might expect it to be executed (like .bashrc)

Is there any way to configure these to swap the filename conventions?

# autoenv

AUTOENV_ENV_FILENAME: Name of the .env file; defaults to .env

# direnv

load_dotenv

If set to true, also look for and load .env files on top of the .envrc files. If both .envrc and .env files exist, the .envrc will always be chosen first.

Couldn't find anything to disable loading the .envrc file.

Regarding disabling loading the .envrc from direnv, it works from an allowlist instead. The first time you cd into a directory with a .envrc you are prompted to `direnv allow` before it will take any action.
Good to know. Thanks!