summaryrefslogtreecommitdiff
path: root/releasenotes
diff options
context:
space:
mode:
authorChris Dent <cdent@anticdent.org>2018-07-25 20:01:37 +0100
committerChris Dent <cdent@anticdent.org>2018-10-17 20:49:05 +0100
commitea8a0f6a8b260474151fb27c2adc9dcc88774850 (patch)
tree0f887fdeadfb202066a8e3c2d763e1efda6ec664 /releasenotes
parentb12783ea0f86dbe030094634f1e25303a6472f3c (diff)
downloadoslo-config-ea8a0f6a8b260474151fb27c2adc9dcc88774850.tar.gz
Add support for looking in environment for config
An _environment source is added that looks in os.environ for values. Using the environment is on by default, but can be shut down by setting `use_env` to False when __call__ is called. The enviroment is inspected before any other sources of config data but the value is used after command line arguments and before config file options. This is done by checking both the command line and config files and then inspecting the location of the result. If it is command_line, we use it. If not, we use the environment value (if any). If there's no environment value, the config file value is used. If checking the command line and config file results in a KeyError, the environment value is used, if set. The names of the environment variables follow the rules described in oslo_config.sources._environment. A new exception has been added: ConfigSourceValueError, this is the superclass of the existing ConfigFileValueError. The code in _do_get has been updated to only use ConfigFileValueError when it is in fact a file from whence a ValueError came. Documentation has been updated and a rlease note created to indicate the new functionality. Change-Id: I3245c40ebdcc96f8e3b2dc0bab3b4aa71d07ad15
Diffstat (limited to 'releasenotes')
-rw-r--r--releasenotes/notes/config-from-environment-3feba7b4cc747d2b.yaml22
1 files changed, 22 insertions, 0 deletions
diff --git a/releasenotes/notes/config-from-environment-3feba7b4cc747d2b.yaml b/releasenotes/notes/config-from-environment-3feba7b4cc747d2b.yaml
new file mode 100644
index 0000000..d78337e
--- /dev/null
+++ b/releasenotes/notes/config-from-environment-3feba7b4cc747d2b.yaml
@@ -0,0 +1,22 @@
+---
+features:
+ - |
+ Support for accessing configuration data in environment variables via the
+ environment backend driver, enabled by default. The environment is checked
+ after command line options, but before configuration files.
+
+ Environment variables are checked for any configuration data. The variable
+ names take the form:
+
+ * A prefix of ``OS_``
+ * The group name, uppercased
+ * Separated from the option name by a `__` (double underscore)
+ * Followed by the name
+
+ For an option that looks like this in the usual INI format::
+
+ [placement_database]
+ connection = sqlite:///
+
+ the corresponding environment variable would be
+ ``OS_PLACEMENT_DATABASE__CONNECTION``.