So this is a funny little thing I thing Stack Overflow has not discussed before. Not really a life and death question, but something I'd like to hear your input.
In short: my program is a bit over engineered in this regard: it takes configuration options from four different places:
The question is, in what order should these be evaluated? I think it's clear that the command line options have the last say, but what about the three others? If the same option is set in both environment and ini-file, which should take precedence?
What about registry, does registry override the ini assuming I use that to change the runtime settings of the program, should I rewrite changes applied to registry into the configuration file as well? Should I set it so that registry settings can't override settings read from environment?
(If you wonder how on earth this is possible, one word: X-macro.)
A configuration file, often shortened to config file, defines the parameters, options, settings and preferences applied to operating systems (OSes), infrastructure devices and applications in an IT context.
At application startup, Spring Boot will look for an environment variable called SPRING_APPLICATION_JSON . It can be used to provide a set of application properties using inline JSON. For example, you can set ec2. public. url property as follows.
Environment variable substitution is supported in both the great_expectations. yml and config variables config_variables.
Ordered by priority i would go this way: cli > envvars > registry > config > defaults
cli
: it takes the options that you surely want to use when you manually start the programenvvar
: generaly used to manually override configuration file options at runtime (often also used today to manage configuration options in containers environments, cf. 12factor app)registry
: specific to Microsoft Windows world, but according to what you said it have almost the same purpose that environment variablesconfig
: defined at installation/configuration time so these are the "user wanted default options"defaults
: minimal config to run securely (for example listen on localhost only) when nothing else is providedIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With