Skip to content

Commit f157f1f

Browse files
Expand environment variables in configuration files (#888)
Co-authored-by: Titan Yuan <[email protected]>
1 parent 461e7e7 commit f157f1f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

hammer/config/config_src.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,9 @@ def load_config_from_string(contents: str, is_yaml: bool, path: str = "unspecifi
10841084
:param path: Path to the folder/package where the config file is located.
10851085
:return: Loaded config dictionary, unpacked.
10861086
"""
1087+
# Expand any environment variables.
1088+
contents = os.path.expandvars(contents)
1089+
10871090
unpacked = unpack(load_yaml(contents) if is_yaml else json.loads(contents))
10881091
unpacked[_CONFIG_PATH_KEY] = path
10891092
return unpacked

0 commit comments

Comments
 (0)