- Exempt /api/config/auth, /api/config/features, /health, /metrics from rate limiting - Fix generic exception handler to return proper JSON for HTTPException instead of re-raising - Add startup log with auth_enabled and version - Add frontend console logging for auth config fetch errors - Show 'Auth: OFF' or 'Auth: misconfigured' on auth button instead of empty text - Add backend debug logging to /api/config/auth endpoint
34 lines
793 B
Python
34 lines
793 B
Python
import structlog
|
|
from config import (
|
|
AI_FEATURES_ENABLED,
|
|
AUTH_CLIENT_ID,
|
|
AUTH_ENABLED,
|
|
AUTH_SCOPE,
|
|
AUTH_TENANT_ID,
|
|
DEFAULT_PAGE_SIZE,
|
|
)
|
|
from fastapi import APIRouter
|
|
|
|
router = APIRouter()
|
|
logger = structlog.get_logger("aoc.config")
|
|
|
|
|
|
@router.get("/config/auth")
|
|
def auth_config():
|
|
logger.debug("Auth config requested", auth_enabled=AUTH_ENABLED)
|
|
return {
|
|
"auth_enabled": AUTH_ENABLED,
|
|
"tenant_id": AUTH_TENANT_ID,
|
|
"client_id": AUTH_CLIENT_ID,
|
|
"scope": AUTH_SCOPE,
|
|
"redirect_uri": None, # frontend uses window.location.origin by default
|
|
}
|
|
|
|
|
|
@router.get("/config/features")
|
|
def features_config():
|
|
return {
|
|
"ai_features_enabled": AI_FEATURES_ENABLED,
|
|
"default_page_size": DEFAULT_PAGE_SIZE,
|
|
}
|