throw on_start() exceptions when tls key/certificate are not present

This commit is contained in:
jesopo 2019-09-15 17:11:45 +01:00
parent 5800fef4c9
commit f8d24bc422

View file

@ -21,6 +21,11 @@ class Module(ModuleManager.BaseModule):
def on_load(self): def on_load(self):
server_username = self.bot.get_setting("fediverse-server", None) server_username = self.bot.get_setting("fediverse-server", None)
if server_username: if server_username:
if not "tls-key" in self.bot.config:
raise ValueError("`tls-key` not provided in bot config")
if not "tls-certificate" in self.bot.config:
raise ValueError("`tls-certificate` not provided in bot config")
server_username, instance = ap_utils.split_username(server_username) server_username, instance = ap_utils.split_username(server_username)
self.server = ap_server.Server(self.bot, server_username, instance) self.server = ap_server.Server(self.bot, server_username, instance)