artemis/titles/pokken/config.py

74 lines
2.0 KiB
Python
Raw Normal View History

2023-02-17 07:09:26 +00:00
from core.config import CoreConfig
2023-03-09 16:38:58 +00:00
class PokkenServerConfig:
2023-02-17 07:09:26 +00:00
def __init__(self, parent_config: "PokkenConfig"):
self.__config = parent_config
2023-03-09 16:38:58 +00:00
@property
def hostname(self) -> str:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "hostname", default="localhost"
)
2023-02-17 07:09:26 +00:00
@property
def enable(self) -> bool:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "enable", default=True
)
2023-02-17 07:09:26 +00:00
@property
def loglevel(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.str_to_loglevel(
CoreConfig.get_config_field(
self.__config, "pokken", "server", "loglevel", default="info"
)
)
2023-02-17 07:09:26 +00:00
@property
def port(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "port", default=9000
)
2023-02-17 07:09:26 +00:00
@property
def port_matching(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "port_matching", default=9001
)
@property
def port_stun(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "port_stun", default=9002
)
@property
def port_turn(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "port_turn", default=9003
)
@property
def port_admission(self) -> int:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "port_admission", default=9004
)
2023-02-17 07:09:26 +00:00
@property
def ssl_cert(self) -> str:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "ssl_cert", default="cert/pokken.crt"
)
2023-02-17 07:09:26 +00:00
@property
def ssl_key(self) -> str:
2023-03-09 16:38:58 +00:00
return CoreConfig.get_config_field(
self.__config, "pokken", "server", "ssl_key", default="cert/pokken.key"
)
2023-02-17 07:09:26 +00:00
class PokkenConfig(dict):
def __init__(self) -> None:
self.server = PokkenServerConfig(self)