pokken: add ssl_enable

This commit is contained in:
Hay1tsme 2023-02-24 13:27:37 -05:00
parent b105418431
commit 6b265ea866
2 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,10 @@ class PokkenServerConfig():
def hostname(self) -> str:
return CoreConfig.get_config_field(self.__config, 'pokken', 'server', 'hostname', default="localhost")
@property
def ssl_enable(self) -> bool:
return CoreConfig.get_config_field(self.__config, 'pokken', 'server', 'ssl_enable', default=False)
@property
def port(self) -> int:
return CoreConfig.get_config_field(self.__config, 'pokken', 'server', 'port', default=9000)

View File

@ -42,7 +42,7 @@ class PokkenServlet(resource.Resource):
def setup(self):
if self.game_cfg.server.enable:
if self.core_cfg.server.is_develop:
if self.core_cfg.server.is_develop and self.game_cfg.server.ssl_enable:
endpoints.serverFromString(reactor, f"ssl:{self.game_cfg.server.port}"\
f":interface={self.game_cfg.server.hostname}:privateKey={self.game_cfg.server.ssl_key}:"\
f"certKey={self.game_cfg.server.ssl_cert}")\