You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 1 година
преди 1 година
преди 1 година
преди 1 година
преди 1 година
преди 1 година
преди 1 година
преди 1 година
12345678910111213141516171819202122232425262728293031323334
  1. # encoding:utf-8
  2. import json
  3. import os
  4. from common.log import logger
  5. config = {}
  6. md5 = None
  7. def load_config():
  8. global config
  9. config_path = "./config.json"
  10. if not os.path.exists(config_path):
  11. raise Exception('配置文件不存在,请根据config-template.json模板创建config.json文件')
  12. config_str = read_file(config_path)
  13. # 将json字符串反序列化为dict类型
  14. config = json.loads(config_str)
  15. logger.info("[INIT] load config: {}".format(config))
  16. return config
  17. def get_root():
  18. return os.path.dirname(os.path.abspath( __file__ ))
  19. def read_file(path):
  20. with open(path, mode='r', encoding='utf-8') as f:
  21. return f.read()
  22. def conf():
  23. return config