Merge PR #444: Guard onboarding manager behind podcast-only demo mode
This commit is contained in:
@@ -48,7 +48,12 @@ load_dotenv(backend_dir / '.env') # backend/.env
|
|||||||
load_dotenv(project_root / '.env') # root .env (fallback)
|
load_dotenv(project_root / '.env') # root .env (fallback)
|
||||||
load_dotenv() # CWD .env (fallback)
|
load_dotenv() # CWD .env (fallback)
|
||||||
|
|
||||||
PODCAST_ONLY_DEMO_MODE = os.getenv("PODCAST_ONLY_DEMO_MODE", "false").lower() in {"1", "true", "yes", "on"}
|
PODCAST_ONLY_DEMO_MODE = os.getenv("PODCAST_ONLY_DEMO_MODE", "false").lower() in {
|
||||||
|
"1",
|
||||||
|
"true",
|
||||||
|
"yes",
|
||||||
|
"on",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def is_podcast_only_demo_mode() -> bool:
|
def is_podcast_only_demo_mode() -> bool:
|
||||||
@@ -58,7 +63,6 @@ def is_podcast_only_demo_mode() -> bool:
|
|||||||
def should_include_non_podcast_features() -> bool:
|
def should_include_non_podcast_features() -> bool:
|
||||||
return not is_podcast_only_demo_mode()
|
return not is_podcast_only_demo_mode()
|
||||||
|
|
||||||
|
|
||||||
# Set up clean logging for end users
|
# Set up clean logging for end users
|
||||||
from logging_config import setup_clean_logging
|
from logging_config import setup_clean_logging
|
||||||
setup_clean_logging()
|
setup_clean_logging()
|
||||||
@@ -195,7 +199,9 @@ rate_limiter = RateLimiter(window_seconds=60, max_requests=200)
|
|||||||
frontend_serving = FrontendServing(app)
|
frontend_serving = FrontendServing(app)
|
||||||
router_manager = RouterManager(app)
|
router_manager = RouterManager(app)
|
||||||
|
|
||||||
onboarding_manager = OnboardingManager(app)
|
onboarding_manager = None
|
||||||
|
if not PODCAST_ONLY_DEMO_MODE:
|
||||||
|
onboarding_manager = OnboardingManager(app)
|
||||||
|
|
||||||
# Middleware Order (FastAPI executes in REVERSE order of registration - LIFO):
|
# Middleware Order (FastAPI executes in REVERSE order of registration - LIFO):
|
||||||
# Registration order: 1. Monitoring 2. Rate Limit 3. API Key Injection
|
# Registration order: 1. Monitoring 2. Rate Limit 3. API Key Injection
|
||||||
@@ -267,7 +273,14 @@ async def router_status():
|
|||||||
# Onboarding management endpoints
|
# Onboarding management endpoints
|
||||||
@app.get("/api/onboarding/status")
|
@app.get("/api/onboarding/status")
|
||||||
async def onboarding_status():
|
async def onboarding_status():
|
||||||
"""Get onboarding manager status."""
|
"""Get onboarding manager status (or demo-mode disabled state)."""
|
||||||
|
if PODCAST_ONLY_DEMO_MODE:
|
||||||
|
return {
|
||||||
|
"enabled": False,
|
||||||
|
"status": "disabled",
|
||||||
|
"message": "Onboarding is disabled for podcast-only demo mode.",
|
||||||
|
"demo_mode": "podcast_only",
|
||||||
|
}
|
||||||
return onboarding_manager.get_onboarding_status()
|
return onboarding_manager.get_onboarding_status()
|
||||||
|
|
||||||
# Include routers using modular utilities
|
# Include routers using modular utilities
|
||||||
|
|||||||
Reference in New Issue
Block a user