A corporation manager and dashboard for EVE Online
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

34 righe
825 B

  1. # -*- coding: utf-8 -*-
  2. import yaml
  3. __all__ = ["Config"]
  4. class Config:
  5. def __init__(self, confdir):
  6. self._filename = confdir / "config.yml"
  7. self._data = None
  8. self._load()
  9. def _load(self):
  10. with self._filename.open("rb") as fp:
  11. self._data = yaml.load(fp)
  12. def get(self, key="", default=None):
  13. obj = self._data
  14. for item in key.split("."):
  15. if item not in obj:
  16. return default
  17. obj = obj[item]
  18. return obj
  19. @property
  20. def scheme(self):
  21. return "https" if self.get("site.https") else "http"
  22. def install(self, app):
  23. app.config["SERVER_NAME"] = self.get("site.canonical")
  24. app.config["PREFERRED_URL_SCHEME"] = self.scheme
  25. app.secret_key = self.get("auth.session_key")