Configuration Hierarchy
One of the norms that most command-line programs conform to is a configuration hierarchy, where earlier values are overridden by later values. If you’ve written software that takes user configuration, you may have created a hierarchy like this before:
- Defaults
- config files
- env variables
- CLI args
In this case, if your software detects conflicting values in the config file and the CLI args, it would prefer the value in the command-line argument that the program was launched with. In other words, the values found closer to the program’s invocation/execution (the CLI argument) “shadow” (obscure, replace) the values further away from execution (a value in the config file).
Most software will follow a certain hierarchy like this when there are multiple ways to configure it. Keep in mind that not all software uses all of these configuration paths, and not all software respects this order exactly.
- Global configuration files, mostly found...