2023-02-17 07:02:21 +01:00
|
|
|
from core.config import CoreConfig
|
|
|
|
|
2023-02-18 21:01:31 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
class DivaServerConfig():
|
|
|
|
def __init__(self, parent_config: "DivaConfig") -> None:
|
|
|
|
self.__config = parent_config
|
2023-02-18 21:01:31 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
@property
|
|
|
|
def enable(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(self.__config, 'diva', 'server', 'enable', default=True)
|
2023-02-18 21:01:31 +01:00
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
@property
|
|
|
|
def loglevel(self) -> int:
|
|
|
|
return CoreConfig.str_to_loglevel(CoreConfig.get_config_field(self.__config, 'diva', 'server', 'loglevel', default="info"))
|
|
|
|
|
2023-02-18 21:01:31 +01:00
|
|
|
|
|
|
|
class DivaModsConfig():
|
|
|
|
def __init__(self, parent_config: "DivaConfig") -> None:
|
|
|
|
self.__config = parent_config
|
|
|
|
|
|
|
|
@property
|
|
|
|
def unlock_all_modules(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(self.__config, 'diva', 'mods', 'unlock_all_modules', default=True)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def unlock_all_items(self) -> bool:
|
|
|
|
return CoreConfig.get_config_field(self.__config, 'diva', 'mods', 'unlock_all_items', default=True)
|
|
|
|
|
|
|
|
|
2023-02-17 07:02:21 +01:00
|
|
|
class DivaConfig(dict):
|
|
|
|
def __init__(self) -> None:
|
2023-02-18 21:01:31 +01:00
|
|
|
self.server = DivaServerConfig(self)
|
|
|
|
self.mods = DivaModsConfig(self)
|