Don’t use environment variables for configuration
nibblestew.blogspot.com
Don’t use environment variables for configuration
1–10 of 296 posts
Re: Don’t use environment variables for configuration
#2I have no issue with env vars for read only configuration. Programs that set env vars... thats where it gets very ugly.
Re: Don’t use environment variables for configuration
#3Re: Don’t use environment variables for configuration
#4Re: Don’t use environment variables for configuration
#5Re: Don’t use environment variables for configuration
#6> The answer is that you, the end user, can not now. Every program is free to do its own thing and most do. If you have ever spent ages wondering why the exact same commands work when run from one terminal but not the other, this is probably why.
If the same program is behaving differently between two systems - it can -only- be the environment that’s different.
> Instead of coming up with a syntax that is as good as possible for the given problem, instead the goal is to produce syntax that is easy to use
Oh to be a developer. The “best possible syntax” is a universe of possibilities - environment variables are, thankfully, limited to strings. If all programs had to be configured with a Turing complete config language - that would just be a programming language! Limitations can set you free.
Sorry for the harsh tone. Please, and I believe I speak for most sysadmins, please continue to use environment variables.
Re: Don’t use environment variables for configuration
#7Re: Don’t use environment variables for configuration
#8Re: Don’t use environment variables for configuration
#9I cannot but think of the large number of times that being able to quickly override some parameter with an env var has helped me achieve something which was not exactly intended by the original author.
Also, env vars are the most common way to override configuration of software that has been dockerized (prepared to run in a Docker container). Plus, containers remember their initial environment, so there is no issue of running afterwards without the env var.
Re: Don’t use environment variables for configuration
#10Maybe I live under a rock, but I feel like command line utilities taking environment variable arguments just isn’t that common of a practice? The only examples I can think of are when an argument is more of a “global variable” that many different commands may find useful such as JAVA_HOME, GITHUB_TOKEN, etc. For web applications and docker containers, environment variables fit easily into the deployment process and f…
Nope, it's quite common. Many standard UNIX cli utilities take some environment variables (including things like LOCALE). Also common in scripts, setting up programming languages paths, etc.
It's also not a bad practice, contrary to what the author says.