* allow json in env variables

This commit is contained in:
Alexander Malysh
2024-11-14 10:25:14 +00:00
committed by Alexander Malysh
parent b30c1523e3
commit c3032feaf7
@@ -1,3 +1,4 @@
import json
import logging import logging
import os import os
from typing import Any from typing import Any
@@ -20,6 +21,11 @@ def _get_var_typed(val):
return True return True
elif val.lower() in ("f", "false"): elif val.lower() in ("f", "false"):
return False return False
# try to convert from json
try:
return json.loads(val)
except json.decoder.JSONDecodeError:
pass
# keep as string # keep as string
return val return val