2 ms·
The title should be "don't sprinkle environment variable reads all over your codebase", not "don't use environment variables". The problems proposed are easily
by nikisweeting 6y ago
The title should be "don't sprinkle environment variable reads all over your codebase", not "don't use environment variables".
The problems proposed are easily fixed by:
1. read all your env vars at startup in a single function, then pass them down from there
2. don't invent your own serialization format, just use json or csv, both work fine in env vars. or use the env var to reference a file path that contains more complex values.
As a devops engineer / sysadmin for going on 10 years now, I pretty strongly disagree with this article. Environment variables are so much better than the alternative.
In the past, programs frequently invented their own configuration loading systems, but over the last few years containerization has strongly nudged most programs towards accepting env vars. The result has been a better, more consistent, and less surprising config experience for everyone, even non-container users.