fixed tests
Python Code Quality / python-code-quality (push) Successful in 9s
Python Test / python-test (push) Successful in 12s

This commit is contained in:
Brian Bjarke Jensen
2025-11-04 21:50:58 +01:00
parent 54f658d093
commit 298fb192de
7 changed files with 346 additions and 15 deletions
+33 -6
View File
@@ -1,9 +1,19 @@
"""Baby Monitor Main Application"""
import os
from fastapi import FastAPI
from fastapi.responses import PlainTextResponse
app = FastAPI()
# Disable docs in production
ENVIRONMENT = os.getenv("ENVIRONMENT", "production")
docs_url = "/docs" if ENVIRONMENT == "development" else None
redoc_url = "/redoc" if ENVIRONMENT == "development" else None
openapi_url = "/openapi.json" if ENVIRONMENT == "development" else None
app = FastAPI(
docs_url=docs_url,
redoc_url=redoc_url,
openapi_url=openapi_url,
)
@app.get("/")
@@ -12,7 +22,24 @@ def read_root() -> dict:
return {"message": "Hello World"}
@app.get("/health", response_class=PlainTextResponse)
def health_check() -> str:
"""Health check endpoint."""
return "OK"
@app.get("/health")
def health_check() -> dict[str, str]:
"""
Health check endpoint for container orchestration.
Returns 200 if the service is alive and able to handle requests.
"""
return {"status": "healthy"}
@app.get("/ready")
def readiness_check() -> dict[str, str]:
"""
Readiness check endpoint for container orchestration.
Returns 200 if the service is ready to accept traffic.
This can include checks for database connectivity, external services, etc.
"""
# Add dependency checks here if needed (database, cache, etc.)
# For now, simple readiness check
return {"status": "ready"}