def load_conf(self, conf_files=None, path_env="WEB_CONF_PATH", files_env="WEB_CONF_FILES", default_ext=".cfg"): logger = get_logger("wok.server", level="info") logger.info("Loading Flask configuration ...") conf_path = os.environ.get(path_env, os.getcwd()) conf_files = _get_conf_files(conf_path, conf_files or [], os.environ.get(files_env), default_ext) for cfg_path in conf_files: logger.info("+++ {}".format(cfg_path)) self.config.from_pyfile(cfg_path)
def create(self, conf=None, type=None, logger=None): type = type or conf.get("type") or self.__default if type is None: raise PluginError("Missing {} type".format(self.__category)) if type not in self.__class_map: raise PluginError("Unknown {}: {}".format(self.__category, type)) if logger is not None: logger.info("Creating '{}' {} ...".format(type, self.__category)) logger.debug("{} configuration: {}".format(self.__category.title(), repr(conf))) return self.__class_map[type](conf)