diff --git a/orochi/bot.py b/orochi/bot.py index b838681..4efa42d 100644 --- a/orochi/bot.py +++ b/orochi/bot.py @@ -621,7 +621,7 @@ class PrepareRoomView(disnake.ui.View): def run(): config = Config.load() - http.run_web_server() + http.run_web_server(config) logger = logging.getLogger('discord') logger.setLevel(logging.DEBUG) diff --git a/orochi/config.py b/orochi/config.py index 929b56b..f59eb28 100644 --- a/orochi/config.py +++ b/orochi/config.py @@ -28,6 +28,9 @@ class Config: brother_channel: int = None brother_channel_webhook: int = None player_roles: dict[str, int] = field(default_factory=dict) + http_host: str = '127.0.0.1' + http_port: int = 5000 + http_debug: bool = True @classmethod def load(cls, filename: str | None = None) -> "Config": diff --git a/orochi/http.py b/orochi/http.py index 5f6e46c..fe3c47f 100644 --- a/orochi/http.py +++ b/orochi/http.py @@ -2,6 +2,7 @@ from threading import Thread from flask import Flask, render_template +from orochi.config import Config from orochi.models import Game app = Flask(__name__) @@ -19,5 +20,8 @@ def admin(): return render_template('list.html', game=game, admin=True) -def run_web_server(): - Thread(target=lambda: app.run(debug=True, use_reloader=False)).start() +def run_web_server(config: Config): + Thread(target=lambda: app.run(host=config.http_host, + port=config.http_port, + debug=config.http_debug, + use_reloader=False)).start()