livebud / bud

The Full-Stack Web Framework for Go
MIT License
5.53k stars 182 forks source link

build: add `direnv` support #393

Closed wheinze closed 1 year ago

wheinze commented 1 year ago

As promised, this PR adds support for direnv to work together with asdf seamlessly.

To make use of it, direnv and asdf-direnv should be set up.

wheinze commented 1 year ago

What also might be interesting in advance is, that we could easily integrate direnv with .env (dotenv) files by using dotenv_if_exists

Recently, I also stumbled upon https://github.com/jdxcode/rtx which looks quite promising to me, but afaik it handles env-specific vars differently and preferably would not be used alongside with direnv. So this might be sth to consider for improvements in the future ;)

matthewmueller commented 1 year ago

What also might be interesting in advance is, that we could easily integrate direnv with .env (dotenv) files by using dotenv_if_exists

I think for an app this might be good, but for an open source project, there's no actually many environment variables, though I'm prototyping environment support this week for Bud 😄


Let's give this a shot either way. Thanks @wheinze!

matthewmueller commented 1 year ago

Hmm... just tried it. Getting:

direnv: loading ~/dev/src/github.com/livebud/bud/.envrc                                                        
direnv: using asdf
/bin/bash:1033: use_asdf: command not found

Sorry, I should have been a bit more clear. Basically, I'd like this to support the following matrix:

Reverting for now, but happy to merge once this is sorted.