Skip to content

Commit

Permalink
Disable docs endpoints in prod env
Browse files Browse the repository at this point in the history
  • Loading branch information
cmyui committed Jun 22, 2024
1 parent 225eeb7 commit 6b8b477
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/init_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from fastapi import Response
from starlette.middleware.base import RequestResponseEndpoint

from app import settings
from app.api import api_router


Expand All @@ -29,7 +30,10 @@ async def http_middleware(


def init_api() -> FastAPI:
app = FastAPI()
app = FastAPI(
docs_url="/docs" if settings.APP_ENV != "production" else None,
redoc_url="/redoc" if settings.APP_ENV != "production" else None,
)
app = init_routes(app)
app = init_middleware(app)
return app
Expand Down

0 comments on commit 6b8b477

Please sign in to comment.