direnv
is a convenience extension for manage shell. It allow user to load and unload environment variables depending on current directory.
Mac
I pick homebrew install: brew install direnv
.
Then add eval "$(direnv hook zsh)"
to .zshrc
file.
Linux
$ sudo apt-get update
$ sudo apt-get install direnv
Then add eval "$(direnv hook zsh)"
to .zshrc
file.
Quick test flow
$ cd ~/test_project
$ echo ${DUMMY}
$ echo export DUMMY=foo > .envrc
# relaunch terminal
$ echo ${DUMMY}
# it will remind us to trust direnv
$ direnv allow
$ echo ${DUMMY}
# should see foo output now
Comments
Join the discussion for this article at here . Our comments is using Github Issues. All of posted comments will display at this page instantly.