fix(version): /api/health lit la version depuis le fichier VERSION — fin de la constante 7.74.3 périmée (7.80.2)
FlowDeck CI / test (push) Failing after 29m53s
FlowDeck CI / lint (push) Failing after 1m30s
FlowDeck CI / docker (push) Skipped

This commit is contained in:
Spark
2026-10-22 17:41:24 -04:00
parent c7da7002ca
commit 73b3fbce6e
3 changed files with 36 additions and 2 deletions
+25 -1
View File
@@ -190,9 +190,33 @@ async def lifespan(_app: FastAPI):
pass
def _lire_version() -> str:
"""Version de l'app depuis le fichier VERSION (source unique).
Avant : une constante codée en dur dans FastAPI(...) — restée à
7.74.3 alors que l'app était en 7.80.1, donc /api/health mentait.
Même logique de repli que dashboard._common._get_app_version.
"""
import os
for chemin in (
os.path.join(os.path.dirname(__file__), "..", "VERSION"),
"/app/VERSION",
):
try:
if os.path.exists(chemin):
with open(chemin) as f:
v = f.read().strip()
if v:
return v
except Exception:
pass
return "0.0.0"
app = FastAPI(
title="FlowDeck",
version="7.74.3",
version=_lire_version(),
docs_url="/docs",
redoc_url="/redoc",
lifespan=lifespan,