Switch settings over to yaml and dataclasses.

This commit is contained in:
2025-03-16 15:08:20 -04:00
parent 9121627d12
commit 2ffc24eb86
3 changed files with 32 additions and 5 deletions
+28
View File
@@ -0,0 +1,28 @@
"""File contains classes defining ${REPO_NAME} settings structure."""
from dataclasses import dataclass
from dataclass_wizard import YAMLWizard
CONFIG_LOCATION = "conf/config.yaml"
@dataclass
class Params:
"""Class defines start parameters that shouldn't be changed."""
discord_token: str
@dataclass
class Settings(YAMLWizard):
"""Class defines all configs required for ${REPO_NAME}."""
params: Params
def save(self) -> None:
"""Save settings to the yaml file."""
self.to_yaml_file(CONFIG_LOCATION)
settings = Settings.from_yaml_file(CONFIG_LOCATION)