EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit 2eb8117d authored by Fabian Schindler's avatar Fabian Schindler
Browse files

Fixing typing issues in config parser

parent aa024334
No related branches found
No related tags found
1 merge request!1Adding path registration capabilities
Pipeline #19132 passed
......@@ -16,7 +16,7 @@ import yaml
ENV_PATTERN = re.compile(r".*?\${(\w+)}.*?")
def constructor_env_variables(loader: yaml.Loader, node: str):
def constructor_env_variables(loader: yaml.Loader, node):
"""Extracts the environment variable from the node's value
Args:
......@@ -28,18 +28,19 @@ def constructor_env_variables(loader: yaml.Loader, node: str):
variable
"""
value = loader.construct_scalar(node)
match = ENV_PATTERN.findall(value) # to find all env variables in line
if match:
full_value = value
for g in match:
env_variable = os.environ.get(
g,
)
if env_variable is not None:
full_value = full_value.replace(f"${{{g}}}", env_variable)
else:
return None
return full_value
if isinstance(value, str):
match = ENV_PATTERN.findall(value) # to find all env variables in line
if match:
full_value = value
for g in match:
env_variable = os.environ.get(
g,
)
if env_variable is not None:
full_value = full_value.replace(f"${{{g}}}", env_variable)
else:
return None
return full_value
return value
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment