Пример #1
0
    async def init(self):
        this_directory = os.path.dirname(__file__)

        self.static = load_config("./config/config.yaml")
        items = await self.model.get_all()
        for key, value in items.items():
            self.cache[value.name] = value
Пример #2
0
    async def init(self):
        this_directory = os.sep.join(
            os.path.abspath(__file__).split(os.sep)[:-2])

        self.static = load_config(
            "{}/config/config.yaml".format(this_directory))
        items = await self.model.get_all()
        for key, value in items.items():
            self.cache[value.name] = value
Пример #3
0
 async def init(self):
     self.static = load_config(self.path_static)
     with open(self.path) as json_file:
         data = json.load(json_file)
         for key, value in data.items():
             self.cache[key] = Config(name=value.get("name"),
                                      value=value.get("value"),
                                      description=value.get("description"),
                                      type=ConfigType(
                                          value.get("type", "string")),
                                      options=value.get("options", None))