tl;dr - use direnv.
I enjoy learning new languages and bouncing between side projects in my spare time. One of the most painful aspects of this, especially given my environment variable heavy approach to config and secret management, is switching between local setups for the various stacks and projects I work with.
Docker has been wonderful at solving many aspects of this, especially in terms of varying databases and database versions. However, the config to setup the app and connect with said databases was still more manual than I cared for. There were a few times this was enough of a pain point for me I considered making my own terminal emulator that was focused on solving my problems as a develop switching environment, hoping it might help others as well.
However, I recently discovered yet another awesome golang project that solved my problems. The tool is is direnv. The basic idea is that there is a .envrc file in the project directory (or a parent directory, so shared config or multiple repos sharing a config is incredibly simple). When I cd into the directory, it will execute the .envrc script. Mine contains several export statements setting the value of keys such as:
or sourcing additional scipts such as $HOME/.venv/pyproject/bin/activate
Thus far, I've been extremely happy with it, and have yet to encounter any issues or even annoyances.