Skip to content

Commit f346ffd

Browse files
new: dont crash in case of unexpected env variable, just tell the user
Signed-off-by: thiswillbeyourgithub <[email protected]>
1 parent d4a1f62 commit f346ffd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

wdoc/utils/env.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,13 @@ def parse(val: str) -> Optional[Union[bool, int, str]]:
9090
if not k.lower().startswith("wdoc_"):
9191
continue
9292
v = parse(os.environ[k])
93-
assert k in locals().keys(), f"Unexpected key env variable starting by 'wdoc_': {k}"
94-
assert is_bearable(
95-
v, valid_types[k]
96-
), f"Unexpected type of env variable '{k}': '{type(v)}' but expected '{valid_types['k']}'"
97-
locals()[k] = v
93+
# assert k in locals().keys(), f"Unexpected key env variable starting by 'wdoc_': {k}."
94+
if k not in locals().keys():
95+
print(
96+
f"Unexpected key env variable starting by 'wdoc_': {k}. This might me a typo in your configuration!"
97+
)
98+
else:
99+
assert is_bearable(
100+
v, valid_types[k]
101+
), f"Unexpected type of env variable '{k}': '{type(v)}' but expected '{valid_types['k']}'"
102+
locals()[k] = v

0 commit comments

Comments
 (0)