feat: dynamic version from VERSION file (v1.3.57)
- Created VERSION file with current version - Health endpoints now read version from VERSION file instead of hardcoded - Fixes issue where health check showed wrong version - main.py /health and /api/v1/system/health now show correct version
This commit is contained in:
parent
0833f149e1
commit
c254e7cb76
@ -6,6 +6,15 @@ Health checks and system information
|
|||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.database import execute_query
|
from app.core.database import execute_query
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Read version from VERSION file
|
||||||
|
def get_version():
|
||||||
|
try:
|
||||||
|
version_file = Path(__file__).parent.parent.parent.parent / "VERSION"
|
||||||
|
return version_file.read_text().strip()
|
||||||
|
except:
|
||||||
|
return "unknown"
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@ -23,7 +32,7 @@ async def health_check():
|
|||||||
return {
|
return {
|
||||||
"status": "healthy",
|
"status": "healthy",
|
||||||
"service": "BMC Hub",
|
"service": "BMC Hub",
|
||||||
"version": "1.0.0",
|
"version": get_version(),
|
||||||
"database": db_status,
|
"database": db_status,
|
||||||
"config": {
|
"config": {
|
||||||
"environment": "production" if not settings.ECONOMIC_DRY_RUN else "development",
|
"environment": "production" if not settings.ECONOMIC_DRY_RUN else "development",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user