setting.py 635 B

123456789101112131415161718192021222324252627282930313233
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on 2023-11-09
  4. ---------
  5. @summary:
  6. ---------
  7. @author: Dzr
  8. """
  9. import platform
  10. from pathlib import Path
  11. import yaml
  12. __all__ = [
  13. 'mongo_conf',
  14. 'redis_conf', 'redis2_conf',
  15. 'jy_proxy',
  16. ]
  17. if platform.system() not in ['Darwin', 'Windows']:
  18. ENV = 'dev.yaml'
  19. else:
  20. ENV = 'test.yaml'
  21. _base_path = Path(__file__).parent
  22. _yaml_conf = (_base_path / 'conf' / ENV).resolve()
  23. with open(_yaml_conf, encoding="utf-8") as f:
  24. _conf = yaml.safe_load(f)
  25. mongo_conf = _conf['mongo']
  26. redis_conf = _conf['redis']
  27. redis2_conf = _conf['redis2']
  28. jy_proxy: dict = _conf['proxy']