support json in setting_set

This commit is contained in:
Lex Berezhny 2019-12-30 15:45:21 -05:00
parent d9b482d90a
commit 454700af05

View file

@ -1028,6 +1028,8 @@ class Daemon(metaclass=JSONRPCServerType):
(dict) Updated dictionary of daemon settings
"""
with self.conf.update_config() as c:
if value and isinstance(value, str) and value[0] in ('[', '{'):
value = json.loads(value)
attr: Setting = getattr(type(c), key)
cleaned = attr.deserialize(value)
setattr(c, key, cleaned)