direnv Memo

«  Upgrade Ubuntu 18.04 to 20.04
Try Flutter with Firebase Cloud Messaging  »

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

References

Published on 13 Jul 2022 Find me on Facebook, Twitter!

«  Upgrade Ubuntu 18.04 to 20.04
Try Flutter with Firebase Cloud Messaging  »

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.