Sujet : Re: Best practice for config files? (Posting On Python-List Prohibited)
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.pythonDate : 23. May 2025, 02:20:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <100oihl$3ob15$4@dont-email.me>
References : 1 2
User-Agent : Pan/0.162 (Pokrosvk)
On Thu, 22 May 2025 17:37:09 -0700, Paul Rubin wrote:
"Michael F. Stemper" <michael.stemper@gmail.com> writes:
>
Should I specify the location of the config file with a command-line
option, or is requiring the program to be executed in the directory
containing the configuration file considered acceptable practice?
You can also use an environment variable.
Remember to follow some reasonable precedence order by which settings
specified one way can be overridden by those specified another way. The
most natural one would seem to be (from highest to lowest)
1) command-line option
2) environment variable
3) user-specific config
4) systemwide config
5) hard-coded