新增 `/deploy/webhook` 接口,支持 Gitea HMAC 签名校验、指定分支部署、构建并发锁与超时控制 添加前端项目部署脚本 `scripts/deploy_front.sh`,负责拉取代码、安装依赖并执行构建 新增部署相关配置项并更新 `.env.example` 示例配置 更新项目文档说明自动部署的使用约定 补充 `.gitignore` 规则忽略证书和 PEM 格式文件
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.database import lifespan
|
|
from app.routers import auth, deploy, orders, payments, products, rituals, temples, todos, uploads, users
|
|
|
|
|
|
app = FastAPI(
|
|
title="Toy User API",
|
|
description="A tiny FastAPI application with Todo and User CRUD APIs.",
|
|
version="0.2.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["http://127.0.0.1:5173", "http://localhost:5173"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
@app.get("/")
|
|
def read_root() -> dict[str, str]:
|
|
return {
|
|
"message": "Welcome to the Toy API.",
|
|
"docs": "/docs",
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check() -> dict[str, str]:
|
|
return {"status": "ok"}
|
|
|
|
|
|
app.include_router(todos.router)
|
|
app.include_router(auth.router)
|
|
app.include_router(users.router)
|
|
app.include_router(temples.router)
|
|
app.include_router(products.router)
|
|
app.include_router(orders.router)
|
|
app.include_router(payments.router)
|
|
app.include_router(rituals.router)
|
|
app.include_router(uploads.router)
|
|
app.include_router(deploy.router)
|