feat: limit environment-variable json parsing to lists

This commit is contained in:
Matthias
2024-12-08 08:30:45 +01:00
parent c3032feaf7
commit 0683ba3a54

View File

@@ -1,8 +1,9 @@
import json
import logging
import os
from typing import Any
import rapidjson
from freqtrade.constants import ENV_VAR_PREFIX
from freqtrade.misc import deep_merge_dicts
@@ -23,8 +24,11 @@ def _get_var_typed(val):
return False
# try to convert from json
try:
return json.loads(val)
except json.decoder.JSONDecodeError:
value = rapidjson.loads(val)
# Limited to lists for now
if isinstance(value, list):
return value
except rapidjson.JSONDecodeError:
pass
# keep as string
return val