3 ms·
Yeah, the article is just confused: > Envvars have some legitimate usages (such as enabling debug logging) but they should never, ever be used for configuring
by earthboundkid 6y ago
Yeah, the article is just confused:
> Envvars have some legitimate usages (such as enabling debug logging) but they should never, ever be used for configuring core functionality of programs.
As though logging weren't core functionality!
The actual thing that is bad is grabbing an environment variable in the middle of your program. You should grab all the configuration in one place and use it to configure local state that is transparently passed around. Furthermore, flags, env vars, and config files are all just maps from strings to configuration, so you should use some system that can transparently layer them on top of one another. All of my new CLIs use flags first and fall back to ENV vars if the flag wasn't set.