Add isolation debug router with deployment verification endpoint

This commit is contained in:
WhiteX 2025-06-12 21:00:57 +03:00 committed by rzmk
parent abbd5444d8
commit 0a9d0df15d
3 changed files with 20 additions and 13 deletions

View file

@ -93,15 +93,3 @@ if __name__ == "__main__":
@app.get("/")
async def root():
return {"Message": "Welcome to LearnHouse ✨"}
# Debug endpoint for deployment verification
@app.get("/debug/deployment")
async def debug_deployment():
import os
return {
"deployment_name": os.environ.get('DEPLOYMENT_NAME', 'NOT_SET'),
"cookie_domain": learnhouse_config.hosting_config.cookie_config.domain,
"api_domain": learnhouse_config.hosting_config.domain,
"database_host": learnhouse_config.database_config.sql_connection_string.split('@')[1].split('/')[0] if '@' in learnhouse_config.database_config.sql_connection_string else "unknown",
"redis_host": learnhouse_config.redis_config.redis_connection_string.split('@')[1].split(':')[0] if '@' in learnhouse_config.redis_config.redis_connection_string else "unknown"
}

View file

@ -2,7 +2,7 @@ import os
from fastapi import APIRouter, Depends
from src.routers import health
from src.routers import usergroups
from src.routers import dev, trail, users, auth, orgs, roles, search
from src.routers import dev, trail, users, auth, orgs, roles, search, debug
from src.routers.ai import ai
from src.routers.courses import chapters, collections, courses, assignments, certifications
from src.routers.courses.activities import activities, blocks
@ -49,6 +49,7 @@ if os.environ.get("CLOUD_INTERNAL_KEY"):
)
v1_router.include_router(health.router, prefix="/health", tags=["health"])
v1_router.include_router(debug.router, prefix="/debug", tags=["debug"])
# Dev Routes
v1_router.include_router(

View file

@ -0,0 +1,18 @@
import os
from fastapi import APIRouter
from config.config import get_learnhouse_config
router = APIRouter()
@router.get("/deployment")
async def debug_deployment():
"""Debug endpoint for deployment verification and isolation testing"""
learnhouse_config = get_learnhouse_config()
return {
"deployment_name": os.environ.get('DEPLOYMENT_NAME', 'NOT_SET'),
"cookie_domain": learnhouse_config.hosting_config.cookie_config.domain,
"api_domain": learnhouse_config.hosting_config.domain,
"database_host": learnhouse_config.database_config.sql_connection_string.split('@')[1].split('/')[0] if '@' in learnhouse_config.database_config.sql_connection_string else "unknown",
"redis_host": learnhouse_config.redis_config.redis_connection_string.split('@')[1].split(':')[0] if '@' in learnhouse_config.redis_config.redis_connection_string else "unknown"
}