Add 'api-port' setting to bot.conf and use it in rest_api.py
This commit is contained in:
parent
6463bb16b5
commit
4058608bf2
2 changed files with 3 additions and 1 deletions
|
@ -9,6 +9,7 @@ tls-certificate =
|
||||||
# key/cert used for REST API
|
# key/cert used for REST API
|
||||||
tls-api-key =
|
tls-api-key =
|
||||||
tls-api-certificate =
|
tls-api-certificate =
|
||||||
|
api-port =
|
||||||
|
|
||||||
# the default channel BitBot automatically joins
|
# the default channel BitBot automatically joins
|
||||||
bot-channel =
|
bot-channel =
|
||||||
|
|
|
@ -126,7 +126,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
self.httpd = None
|
self.httpd = None
|
||||||
if self.bot.get_setting("rest-api", False):
|
if self.bot.get_setting("rest-api", False):
|
||||||
self.httpd = http.server.HTTPServer(("", 5000), Handler)
|
port = int(self.bot.config.get("api-port", "5000"))
|
||||||
|
self.httpd = http.server.HTTPServer(("", port), Handler)
|
||||||
|
|
||||||
self.httpd.socket = utils.security.ssl_wrap(self.httpd.socket,
|
self.httpd.socket = utils.security.ssl_wrap(self.httpd.socket,
|
||||||
cert=self.bot.config["tls-api-certificate"],
|
cert=self.bot.config["tls-api-certificate"],
|
||||||
|
|
Loading…
Reference in a new issue