def save(config, is_system=False):
"""
Save configuration ``config``.
"""
ConfigurationManager.update(config)
location = SYSTEM_CONFIG if is_system else RUNTIME_CONFIG
try:
LOG.info("Saving config: " + location)
dir = location.replace("/jarbas_runtime.conf", "").replace(
"/jarbas.conf", "")
if not exists(dir):
mkdir(dir)
try:
loc_config = load_commented_json(location)
except:
loc_config = {}
with open(location, 'w') as f:
config = loc_config.update(config)
json.dump(config, f)
except Exception as e:
LOG.error(e)
评论列表
文章目录