mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-10-05 02:56:29 +00:00
🔧 重构配置管理,添加配置文件支持,更新日志系统,优化守护进程,完善测试用例
This commit is contained in:
@@ -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()
|
Reference in New Issue
Block a user