24 lines
539 B
Python
24 lines
539 B
Python
"""vps-manager 后端入口"""
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
|
|
from app.database import init_db
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(_: FastAPI):
|
|
"""应用启动时自动建表"""
|
|
init_db()
|
|
yield
|
|
|
|
|
|
app = FastAPI(title="VPS 资产管理系统", version="0.1.2", lifespan=lifespan)
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check() -> dict:
|
|
"""健康检查(version 动态读取,便于验证自动更新)"""
|
|
return {"status": "ok", "app": "vps-manager", "version": app.version}
|