release: v1.0.0 — Production
- FastAPI lifespan (deprecation fix, 0 warnings)
- 28 tests (vues, filtres, tris, APIs, CSRF, CORS, DB)
- CI/CD Gitea Actions (.gitea/workflows/ci.yml)
- Version 1.0.0: main.py, api.py, health endpoint
- CHANGELOG.md v1.0.0
- ARCHITECTURE.md: 12 tables, routes complètes
- ROADMAP: all versions ✅
This commit is contained in:
+18
-39
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
@@ -14,44 +15,37 @@ from app.middleware.csrf import CSRFMiddleware
|
||||
from app.routers import dashboard, board, notes, api, auth, webhooks
|
||||
from app.services.gitea_client import gitea
|
||||
|
||||
# ── logging ──
|
||||
|
||||
logging.basicConfig(
|
||||
level=getattr(logging, settings.log_level.upper(), logging.INFO),
|
||||
format="%(asctime)s [%(levelname)s] %(message)s",
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# ── app ──
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(_app: FastAPI):
|
||||
init_db()
|
||||
from app.db import get_conn
|
||||
with get_conn() as conn:
|
||||
conn.execute(
|
||||
"INSERT OR IGNORE INTO users (login, full_name, email, is_admin) VALUES ('admin', 'Admin', '', 1)"
|
||||
)
|
||||
conn.commit()
|
||||
logger.info("FlowDeck v1.0.0 started on port %d", settings.app_port)
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="FlowDeck",
|
||||
version="0.3.0",
|
||||
version="1.0.0",
|
||||
docs_url="/docs" if settings.log_level == "DEBUG" else None,
|
||||
redoc_url=None,
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
# ── middleware (order matters) ──
|
||||
|
||||
# Session (for OAuth2 state)
|
||||
app.add_middleware(
|
||||
SessionMiddleware,
|
||||
secret_key=settings.app_secret_key,
|
||||
max_age=3600, # 1 hour for OAuth state
|
||||
)
|
||||
|
||||
# CSRF protection
|
||||
app.add_middleware(SessionMiddleware, secret_key=settings.app_secret_key, max_age=3600)
|
||||
app.add_middleware(CSRFMiddleware)
|
||||
|
||||
# CORS for LAN access
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# ── routers ──
|
||||
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"])
|
||||
|
||||
app.include_router(auth.router)
|
||||
app.include_router(dashboard.router)
|
||||
@@ -60,19 +54,4 @@ app.include_router(notes.router)
|
||||
app.include_router(api.router)
|
||||
app.include_router(webhooks.router)
|
||||
|
||||
# ── static ──
|
||||
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
async def startup():
|
||||
init_db()
|
||||
# Seed admin user for non-OAuth mode
|
||||
from app.db import get_conn
|
||||
with get_conn() as conn:
|
||||
conn.execute(
|
||||
"INSERT OR IGNORE INTO users (login, full_name, email, is_admin) VALUES ('admin', 'Admin', '', 1)"
|
||||
)
|
||||
conn.commit()
|
||||
logger.info("FlowDeck v0.3.0 started on port %d", settings.app_port)
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ async def health():
|
||||
|
||||
return {
|
||||
"status": "ok" if (db_ok and gitea_ok) else "degraded",
|
||||
"version": "0.3.0",
|
||||
"version": "1.0.0",
|
||||
"db": db_ok,
|
||||
"gitea": gitea_ok,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user