Add health endpoint at root path
This commit is contained in:
parent
a5cc37869c
commit
1e6e4cfa8b
13
main.py
13
main.py
@ -3,12 +3,10 @@ import socket
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import Depends, FastAPI
|
from fastapi import FastAPI
|
||||||
from sqlalchemy.orm import Session
|
|
||||||
|
|
||||||
from app.api.api import api_router
|
from app.api.api import api_router
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.db.session import get_db
|
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
@ -21,6 +19,15 @@ app = FastAPI(
|
|||||||
version="0.1.0",
|
version="0.1.0",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@app.get("/health", tags=["health"], summary="Health check endpoint")
|
||||||
|
def health_check():
|
||||||
|
"""
|
||||||
|
Basic health check that always returns status ok.
|
||||||
|
|
||||||
|
This endpoint is used by monitoring systems to check if the application is running.
|
||||||
|
"""
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
app.include_router(api_router, prefix=settings.API_V1_STR)
|
app.include_router(api_router, prefix=settings.API_V1_STR)
|
||||||
|
|
||||||
def find_available_port(start_port, max_attempts=10):
|
def find_available_port(start_port, max_attempts=10):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user