|
|
@@ -237,12 +237,14 @@ def drag_sensitive(config): |
|
|
|
conf_dict: dict = json.loads(config) |
|
|
|
for key in conf_dict: |
|
|
|
if "key" in key or "secret" in key: |
|
|
|
conf_dict[key] = conf_dict[key][0:3] + "*" * 5 + conf_dict[key][-3:] |
|
|
|
if isinstance(key, str): |
|
|
|
conf_dict[key] = conf_dict[key][0:3] + "*" * 5 + conf_dict[key][-3:] |
|
|
|
return json.dumps(conf_dict, indent=4) |
|
|
|
elif isinstance(config, dict): |
|
|
|
for key in config: |
|
|
|
if "key" in key or "secret" in key: |
|
|
|
config[key] = config[key][0:3] + "*" * 5 + config[key][-3:] |
|
|
|
if isinstance(key, str): |
|
|
|
config[key] = config[key][0:3] + "*" * 5 + config[key][-3:] |
|
|
|
return config |
|
|
|
|
|
|
|
return config |
|
|
@@ -256,7 +258,7 @@ def load_config(): |
|
|
|
config_path = "./config-template.json" |
|
|
|
|
|
|
|
config_str = read_file(config_path) |
|
|
|
logger.debug("[INIT] config str: {}".format(drag_sensitive(config_str))) |
|
|
|
logger.debug("[INIT] config str: {}".format(config_str)) |
|
|
|
|
|
|
|
# 将json字符串反序列化为dict类型 |
|
|
|
config = Config(json.loads(config_str)) |
|
|
@@ -281,7 +283,7 @@ def load_config(): |
|
|
|
logger.setLevel(logging.DEBUG) |
|
|
|
logger.debug("[INIT] set log level to DEBUG") |
|
|
|
|
|
|
|
logger.info("[INIT] load config: {}".format(drag_sensitive(config))) |
|
|
|
logger.info("[INIT] load config: {}".format(config)) |
|
|
|
|
|
|
|
config.load_user_datas() |
|
|
|
|
|
|
|