feat(backend): 添加服务管理脚本并配置应用基础参数
- 更新 .gitignore 忽略后端日志目录和 PID 文件 - 新增 app_name 配置项并替换主程序中硬编码的应用名称 - 为配置模型添加 extra: ignore 以兼容额外环境变量 - 新增完整的后端服务管理脚本 serv.sh,支持常用管理操作
This commit is contained in:
@@ -28,7 +28,7 @@ logging.basicConfig(
|
||||
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S",
|
||||
)
|
||||
logger = logging.getLogger("孕育无忧")
|
||||
logger = logging.getLogger(settings.app_name)
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
@@ -42,7 +42,7 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="孕育无忧 API",
|
||||
title=f"{settings.app_name} API",
|
||||
description="孕期健康检查报告解读后端服务",
|
||||
version="1.0.0",
|
||||
lifespan=lifespan,
|
||||
@@ -111,7 +111,7 @@ app.include_router(share.router, prefix=f"{api_prefix}/share", tags=["分享"])
|
||||
|
||||
@app.get(f"{api_prefix}/health")
|
||||
async def health_check():
|
||||
return {"status": "ok", "service": "孕育无忧 API"}
|
||||
return {"status": "ok", "service": f"{settings.app_name} API"}
|
||||
|
||||
|
||||
@app.get("/")
|
||||
|
||||
Reference in New Issue
Block a user