2023-02-17 08:09:26 +01:00
|
|
|
from core.config import CoreConfig
|
|
|
|
|
2023-03-09 17:38:58 +01:00
|
|
|
|
|
|
|
class PokkenServerConfig:
|
2023-02-17 08:09:26 +01:00
|
|
|
def __init__(self, parent_config: "PokkenConfig"):
|
|
|
|
self.__config = parent_config
|
2023-03-09 17:38:58 +01:00
|
|
|
|
2023-03-05 03:27:52 +01:00
|
|
|
@property
|
|
|
|
def hostname(self) -> str:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "pokken", "server", "hostname", default="localhost"
|
|
|
|
)
|
|
|
|
|
2023-02-17 08:09:26 +01:00
|
|
|
@property
|
|
|
|
def enable(self) -> bool:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "pokken", "server", "enable", default=True
|
|
|
|
)
|
2023-02-17 08:09:26 +01:00
|
|
|
|
|
|
|
@property
|
|
|
|
def loglevel(self) -> int:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.str_to_loglevel(
|
|
|
|
CoreConfig.get_config_field(
|
|
|
|
self.__config, "pokken", "server", "loglevel", default="info"
|
|
|
|
)
|
|
|
|
)
|
2023-02-17 08:09:26 +01:00
|
|
|
|
|
|
|
@property
|
|
|
|
def port(self) -> int:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "pokken", "server", "port", default=9000
|
|
|
|
)
|
2023-02-17 08:09:26 +01:00
|
|
|
|
2023-03-05 03:27:52 +01:00
|
|
|
@property
|
|
|
|
def port_stun(self) -> int:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
2023-03-12 05:42:12 +01:00
|
|
|
self.__config, "pokken", "server", "port_stun", default=9001
|
2023-03-09 17:38:58 +01:00
|
|
|
)
|
2023-03-05 03:27:52 +01:00
|
|
|
|
|
|
|
@property
|
|
|
|
def port_turn(self) -> int:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
2023-03-12 05:42:12 +01:00
|
|
|
self.__config, "pokken", "server", "port_turn", default=9002
|
2023-03-09 17:38:58 +01:00
|
|
|
)
|
2023-03-05 03:27:52 +01:00
|
|
|
|
|
|
|
@property
|
|
|
|
def port_admission(self) -> int:
|
2023-03-09 17:38:58 +01:00
|
|
|
return CoreConfig.get_config_field(
|
2023-03-12 05:42:12 +01:00
|
|
|
self.__config, "pokken", "server", "port_admission", default=9003
|
2023-03-09 17:38:58 +01:00
|
|
|
)
|
|
|
|
|
2023-04-10 10:42:40 +02:00
|
|
|
@property
|
|
|
|
def auto_register(self) -> bool:
|
|
|
|
"""
|
|
|
|
Automatically register users in `aime_user` on first carding in with pokken
|
|
|
|
if they don't exist already. Set to false to display an error instead.
|
|
|
|
"""
|
|
|
|
return CoreConfig.get_config_field(
|
|
|
|
self.__config, "pokken", "server", "auto_register", default=True
|
|
|
|
)
|
|
|
|
|
2023-04-24 03:04:52 +02:00
|
|
|
|
2023-02-17 08:09:26 +01:00
|
|
|
class PokkenConfig(dict):
|
|
|
|
def __init__(self) -> None:
|
|
|
|
self.server = PokkenServerConfig(self)
|