Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

19 lignes
773B

  1. import os
  2. import yaml
  3. from common import Constant
  4. # 从配置文件读取所有配置信息
  5. def getConfigs():
  6. print("开始读取配置文件,获取配置消息:", Constant.APPLICATION_CONFIG)
  7. applicationConfigPath = os.path.abspath(Constant.APPLICATION_CONFIG)
  8. if not os.path.exists(applicationConfigPath):
  9. raise Exception("未找到配置文件:{}".format(Constant.APPLICATION_CONFIG))
  10. with open(applicationConfigPath, Constant.R, encoding=Constant.UTF_8) as f:
  11. file_content = f.read()
  12. content = yaml.load(file_content, yaml.FullLoader)
  13. if not content:
  14. raise Exception("配置项不能为空:{}".format(Constant.APPLICATION_CONFIG))
  15. print("读取配置文件完成!")
  16. return content