1
0
Fork 0
gaiety-life/content/tils/asdf_direnv.md
2023-09-13 11:35:21 -04:00

845 B

title date
asdf with direnv to load env variables automatically 2023-06-26

asdf is a powerful tool to manage runtime versions based on the project you're in, but it can do so much more. Beyond just switching a ruby, node, elixir etc version there are plugins like asdf-direnv which can automatically leverage the direnv tool as a way to set up per-project environment variables.

asdf plugin-add direnv
asdf direnv setup --shell bash --version latest

Now, you may navigate to your project you need to export variables for and run direnv allow . and create a .envrc file like the following:

export FOO=BAR

Now the next time you change directory to this project $FOO should automatically be exported!