This commit is contained in:
hhh
2025-01-02 22:19:43 +02:00
commit 9e29d01f1d
28 changed files with 1171 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import tomllib
class Config(dict):
def __init__(self, _config: dict = None):
try:
if _config is None:
super().__init__(**tomllib.load(open("config.toml", "rb")))
else:
super().__init__(**_config)
except FileNotFoundError:
super().__init__()
def __getattr__(self, item):
if not isinstance(self.get(item), dict):
return self.get(item)
else:
return self.__class__(_config=self.get(item))