mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 08:13:01 +00:00
26 lines
469 B
Python
26 lines
469 B
Python
import tomli
|
|
from pydantic import BaseModel
|
|
|
|
from .dav_common import dav_get_textfile_content
|
|
from .settings import SETTINGS
|
|
|
|
|
|
class User(BaseModel):
|
|
name: str
|
|
password: str
|
|
|
|
|
|
class Puzzle(BaseModel):
|
|
background: str
|
|
solution: str
|
|
|
|
|
|
class Config(BaseModel):
|
|
admin: User
|
|
puzzle: Puzzle
|
|
|
|
|
|
async def get_config() -> Config:
|
|
txt = await dav_get_textfile_content(path=SETTINGS.config_filename)
|
|
|
|
return Config.model_validate(tomli.loads(txt))
|