summaryrefslogtreecommitdiff
path: root/oslo_config/sources/_environment.py
diff options
context:
space:
mode:
Diffstat (limited to 'oslo_config/sources/_environment.py')
-rw-r--r--oslo_config/sources/_environment.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/oslo_config/sources/_environment.py b/oslo_config/sources/_environment.py
index 19dc093..7caaa43 100644
--- a/oslo_config/sources/_environment.py
+++ b/oslo_config/sources/_environment.py
@@ -77,12 +77,19 @@ class EnvironmentConfigurationSource(sources.ConfigurationSource):
"""A configuration source for options in the environment."""
@staticmethod
- def _make_name(group_name, option_name):
+ def get_name(group_name, option_name):
+ """Return the expected environment variable name for the given option.
+
+ :param group_name: The group name or None. Defaults to 'DEFAULT' if
+ None.
+ :param option_name: The option name.
+ :returns: Th expected environment variable name.
+ """
group_name = group_name or 'DEFAULT'
return 'OS_{}__{}'.format(group_name.upper(), option_name.upper())
def get(self, group_name, option_name, opt):
- env_name = self._make_name(group_name, option_name)
+ env_name = self.get_name(group_name, option_name)
try:
value = os.environ[env_name]
loc = oslo_config.cfg.LocationInfo(