update:启动时检查配置文件 (#155)

Co-authored-by: hrz <1710360675@qq.com>
This commit is contained in:
欣南科技
2025-02-28 19:17:36 +08:00
committed by GitHub
co-authored by hrz
parent 242f4d87e7
commit 2c88a36f32
2 changed files with 66 additions and 8 deletions
+6 -3
View File
@@ -1,6 +1,6 @@
import asyncio
from config.logger import setup_logging
from config.settings import load_config
from config.settings import load_config, check_config_file
from core.websocket_server import WebSocketServer
from manager.http_server import WebUI
from aiohttp import web
@@ -8,10 +8,12 @@ from core.utils.util import get_local_ip
TAG = __name__
async def main():
check_config_file()
logger = setup_logging()
config = load_config()
# 启动 WebSocket 服务器
ws_server = WebSocketServer(config)
ws_task = asyncio.create_task(ws_server.start())
@@ -33,7 +35,7 @@ async def main():
logger.bind(tag=TAG).info(f"WebUI server is running at http://{local_ip}:{port}")
except Exception as e:
logger.bind(tag=TAG).error(f"Failed to start WebUI server: {e}")
try:
# 等待 WebSocket 服务器运行
await ws_task
@@ -42,5 +44,6 @@ async def main():
if webui_runner:
await webui_runner.cleanup()
if __name__ == "__main__":
asyncio.run(main())