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!