artemis/titles/cxb/config.py

32 lines
822 B
Python
Raw Permalink Normal View History

from core.config import CoreConfig
2023-03-09 16:38:58 +00:00
class CxbServerConfig:
def __init__(self, parent_config: "CxbConfig"):
self.__config = parent_config
2023-03-09 16:38:58 +00:00
@property
def enable(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "cxb", "server", "enable", default=True
)
@property
def loglevel(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.str_to_loglevel(
CoreConfig.get_config_field(
self.__config, "cxb", "server", "loglevel", default="info"
)
)
2024-01-09 22:49:18 +00:00
@property
def use_https(self) -> bool:
return CoreConfig.get_config_field(
self.__config, "cxb", "server", "use_https", default=True
)
class CxbConfig(dict):
def __init__(self) -> None:
self.server = CxbServerConfig(self)