diff options
author | Ben Nemec <bnemec@redhat.com> | 2019-04-22 16:13:29 +0000 |
---|---|---|
committer | Ben Nemec <bnemec@redhat.com> | 2019-04-23 20:36:29 +0000 |
commit | 144e16d532be4edd6736b31a00d56322749ce89a (patch) | |
tree | a791be499bab27de5200070705fabe9d34c00234 | |
parent | 2ee2ad69e357b81afdf2ef7e7482547e12e348c6 (diff) | |
download | oslo-config-144e16d532be4edd6736b31a00d56322749ce89a.tar.gz |
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: https://github.com/openstack/oslo.config/blob/0bc22839b09fcd7ae2de4f7fe5d63ac055fd0a78/oslo_config/cfg.py#L2095
Closes-Bug: 1825859
-rw-r--r-- | doc/source/configuration/options.rst | 17 | ||||
-rw-r--r-- | doc/source/reference/configuration-files.rst | 5 |
2 files changed, 21 insertions, 1 deletions
diff --git a/doc/source/configuration/options.rst b/doc/source/configuration/options.rst index 53173f3..0800936 100644 --- a/doc/source/configuration/options.rst +++ b/doc/source/configuration/options.rst @@ -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 diff --git a/doc/source/reference/configuration-files.rst b/doc/source/reference/configuration-files.rst index 7544749..b4e299d 100644 --- a/doc/source/reference/configuration-files.rst +++ b/doc/source/reference/configuration-files.rst @@ -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: |