M35: harden the shared public demo
This commit is contained in:
+10
-1
@@ -55,7 +55,15 @@ async def lifespan(_app: FastAPI):
|
||||
stop_background_dispatcher()
|
||||
|
||||
|
||||
app = FastAPI(title=f"{PRODUCT_NAME} API", version="0.1.0", lifespan=lifespan)
|
||||
production = settings.mobilityops_env.lower() == "production"
|
||||
app = FastAPI(
|
||||
title=f"{PRODUCT_NAME} API",
|
||||
version="0.1.0",
|
||||
lifespan=lifespan,
|
||||
docs_url=None if production else "/docs",
|
||||
redoc_url=None if production else "/redoc",
|
||||
openapi_url=None if production else "/openapi.json",
|
||||
)
|
||||
|
||||
app.add_middleware(
|
||||
SessionMiddleware,
|
||||
@@ -126,6 +134,7 @@ def handle_http_exception(request: Request, exc: HTTPException) -> JSONResponse:
|
||||
correlation_id=getattr(request.state, "correlation_id", str(uuid.uuid4())),
|
||||
details={},
|
||||
),
|
||||
headers=exc.headers,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user