You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
399 B
Python

"""
Config related tools.
"""
import dataclasses
import yaml
@dataclasses.dataclass
class Config:
username: str
homeserver: str
password: str
allert_rooms: list[str]
def load_config(file:str)->Config:
"""
Load the config from the config file.
"""
with open(file, 'r') as f:
data = yaml.load(f, Loader=yaml.loader.SafeLoader)
return Config(**data)