Re: Best practice for config files? (Posting On Python-List Prohibited)
Lawrence D'Oliveiro <[email protected]> Fri, 23 May 2025 01:20:53 -0000 (UTC)
| Newsgroups | comp.lang.python |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
On Thu, 22 May 2025 17:37:09 -0700, Paul Rubin wrote: > "Michael F. Stemper" <[email protected]> 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