From 226909f7d9bfd6cd1cdf870a9697d0fbf3832900 Mon Sep 17 00:00:00 2001 From: a3510377 Date: Sat, 2 Mar 2024 18:15:33 +0800 Subject: [PATCH] feat host config --- server/core/config.py | 1 + server/core/server.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/core/config.py b/server/core/config.py index 74cdaee..833a6fe 100644 --- a/server/core/config.py +++ b/server/core/config.py @@ -30,6 +30,7 @@ class ConfigType(NamedTuple): } # dict[name, UserAuth] plugins_path: str = "plugins" port: str = 8081 + host: str = "localhost" class Config(Generic[_RT]): diff --git a/server/core/server.py b/server/core/server.py index 425aa69..cacb991 100644 --- a/server/core/server.py +++ b/server/core/server.py @@ -219,7 +219,7 @@ async def start(self) -> web.AppRunner: runner = web.AppRunner(self.app) await runner.setup() port = int(self.config.get("port", os.getenv("PORT"))) - site = web.TCPSite(runner, "localhost", port) + site = web.TCPSite(runner, self.config.get("host", os.getenv("HOST")), port) await site.start() print(f"======= Serving on http://localhost:{port}/ ======")