configHandler.py 850 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. """
  3. -------------------------------------------------
  4. File Name: configHandler
  5. Description :
  6. Author : JHao
  7. date: 2020/6/22
  8. -------------------------------------------------
  9. Change Activity:
  10. 2020/6/22:
  11. -------------------------------------------------
  12. """
  13. __author__ = 'JHao'
  14. import os
  15. import setting
  16. from util.singleton import Singleton
  17. from util.lazyProperty import LazyProperty
  18. class ConfigHandler(object):
  19. __metaclass__ = Singleton
  20. def __init__(self):
  21. pass
  22. @LazyProperty
  23. def serverHost(self):
  24. return os.environ.get("HOST", setting.HOST)
  25. @LazyProperty
  26. def serverPort(self):
  27. return os.environ.get("PORT", setting.PORT)
  28. @LazyProperty
  29. def dbConn(self):
  30. return os.getenv("DB_CONN", setting.DB_CONN)