direnv: .envrc a symlink does not throw error

I want to easily switch .envrc (based on environment in my case).

Here is the way to reproduce my issue…

cd $(mktemp -d)

cat << 'EOF' > .envrc--production
export ENV=production
EOF

cat << 'EOF' > .envrc--development
export ENV=development
EOF

ln --symbolic --force .envrc--development .envrc
# direnv: error .envrc is blocked. Run `direnv allow` to approve its content.

direnv allow

echo $ENV
# development

If I want to switch env to production I then run:

ln --symbolic --force .envrc--production .envrc
# (...no error thrown)

echo $ENV
# development (instead of production, ... nothing loaded)

No error is throw and $ENV is still set to development. I still can force it with direnv reload, but it is ugly.

WDYT, is it a bug or a feature 😃

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

this is fixed by #452 🎉