advent22/api/advent22_api/config.py
2022-11-04 18:49:31 +00:00

16 lines
349 B
Python

import tomli
from pydantic import BaseModel
from .dav_common import dav_get_textfile_content
from .settings import SETTINGS
class Config(BaseModel):
admin_password: str
solution: str
async def get_config() -> Config:
txt = await dav_get_textfile_content(path=SETTINGS.config_filename)
return Config.parse_obj(tomli.loads(txt))