mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
feat: limit environment-variable json parsing to lists
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user