Hacker News new | ask | show | jobs
by weinzierl 563 days ago
"Ideally CLI flags merged over top of environment variables merged over top of configuration files."

I used to wish for that too but I have changed my mind. I think in real world applications with many options it is preferable to not allow every option to be set in every way.

Environment variables shine for properties that vary per instances which share config files and for system properties (think $GOMAXPROCS).

Secrets should never go in the command line nor the environment.

There is no one size fits all. Arguments, environment and config files have different pros and cons and should be used accordingly.

1 comments

Yeah I agree, and do the same. Likewise some config gets complex and can only be reasonably set through config. I prefer when I have a system with one base configuration struct where certain fields can be tagged as available on the command line, another subset in the environment, etc.