mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
Fix constants to use environment variables in preference to config files
This commit is contained in:
parent
f7d000fe74
commit
0ee9972903
1 changed files with 5 additions and 4 deletions
|
@ -124,10 +124,6 @@ def get_config(p, section, key, env_var, default, value_type=None, expand_relati
|
||||||
def _get_config(p, section, key, env_var, default):
|
def _get_config(p, section, key, env_var, default):
|
||||||
''' helper function for get_config '''
|
''' helper function for get_config '''
|
||||||
value = default
|
value = default
|
||||||
if env_var is not None:
|
|
||||||
env_value = os.environ.get(env_var, None)
|
|
||||||
if env_value is not None:
|
|
||||||
value = env_value
|
|
||||||
|
|
||||||
if p is not None:
|
if p is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -135,6 +131,11 @@ def _get_config(p, section, key, env_var, default):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if env_var is not None:
|
||||||
|
env_value = os.environ.get(env_var, None)
|
||||||
|
if env_value is not None:
|
||||||
|
value = env_value
|
||||||
|
|
||||||
return to_text(value, errors='surrogate_or_strict', nonstring='passthru')
|
return to_text(value, errors='surrogate_or_strict', nonstring='passthru')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue