3 ms·
I hate environment variables so much. They’re the source of so much pain and suffering. I never write code that uses envvars. Always use cmdline args or a conf
by forrestthewoods 2y ago
I hate environment variables so much. They’re the source of so much pain and suffering.
I never write code that uses envvars. Always use cmdline args or a config file.
If I were designing an OS I’d do everything in my power to not have an envvar API. It’s probably not possible, but damnit I’d try
- syndicatedjelly 2y agoI was about to comment something like, “you’re strange”, but then I remembered how I spent the last several nights debugging server issues that basically boiled down to badly set environment variables. I added code to the startup script to explicitly throw when the env variables are not set/empty, but this papers over a problem and just makes debugging easier. It doesn’t solve it.
- flashgordon 2y agoId like to hear more. I've also felt this way but have fallen back on them (plus been too scared to question the conventional wisdom).
- cheptsov 2y agoEnvironment variables are especially convenient IMO for parameterizing Docker images when running containers, e.g. using Docker or Kubernetes, etc. Also, for configuring all sort of credentials for libraries, e.g. AWS, WandB, HuggingFace, etc.
- forrestthewoods 2y agoI also hate Docker and think it only exists because modern design principles have failed. Reliably launching a software program shouldn't be difficult. But instead we've chosen to rely on a big ugly fragile ball of global system/environment state. And the only way to even launch a program is with heavyweight containers. Running a computer program shouldn't require a Docker image. Which in turn alleviates the need to use gross environment variables.