🔧 重构配置管理,添加配置文件支持,更新日志系统,优化守护进程,完善测试用例

This commit is contained in:
2025-04-29 02:51:37 +08:00
parent fec96e694d
commit 56996ef082
16 changed files with 323 additions and 139 deletions

View File

@@ -1,8 +1,5 @@
import asyncio
import uvicorn
from fastapi import FastAPI
import hypercorn
import hypercorn.run
app = FastAPI()
@@ -11,10 +8,8 @@ async def root():
return {"message": "Hello LiteyukiBot"}
async def run_app():
"""liteyukibot入口函数
"""
hypercorn.run.serve(app, config=hypercorn.Config.from_mapping(
bind=["localhost:8000"],
workers=1,
))
async def run_app(**kwargs):
"""ASGI app 启动函数,在所有插件加载完后任务启动"""
config = uvicorn.Config(app, **kwargs, log_config=None)
server = uvicorn.Server(config)
await server.serve()