Document precedence of config sources

Previously the precedence details for the various sources oslo.config
can consume were scattered around the developer documentation (for
example in [0]). Since this is relevant for users too, we need to
include it in the user-focused documentation.

This collects all of the precedence information I am aware of and puts
it on the documentation page for --config-file, --config-dir, and the
sample source driver options.

It also clarifies the file and dir precedence in the developer docs since
previously that was only available in the API docstring.

Change-Id: I41d8ac0f33ea60aea8ba5b150e53d7eafa323457
0: 0bc22839b0/oslo_config/cfg.py (L2095)
Closes-Bug: 1825859
This commit is contained in:
Ben Nemec 2019-04-22 16:13:29 +00:00
parent 2ee2ad69e3
commit 144e16d532
2 changed files with 21 additions and 1 deletions

View File

@ -2,6 +2,23 @@
Configuration Options from oslo.config
========================================
When loading values from the sources defined by the following options, the
precedence is as follows:
#. Command Line
#. Environment Variables
#. Config Files from ``--config-dir`` [1]_
#. Config Files from ``--config-file``
#. Pluggable Config Sources
If a value is specified in multiple locations, the location used will be the
one higher in the list. For example, if a value is specified both on the
command line and in an environment variable, the value from the command line
will be the one returned.
.. [1] Files in a config dir are parsed in alphabetical order. Later files
take precedence over earlier ones.
.. show-options::
oslo.config

View File

@ -42,7 +42,10 @@ option name) can appear many times, in config files or on the command line.
Later values always override earlier ones.
The order of configuration files inside the same configuration directory is
defined by the alphabetic sorting order of their file names.
defined by the alphabetic sorting order of their file names. Files in a
configuration directory are parsed after any individual configuration files,
so values that appear in both a configuration file and configuration directory
will use the value from the directory.
The parsing of CLI args and config files is initiated by invoking the config
manager for example: