Skip to content

Commit

Permalink
chore: openapi url disabled if debug mode is false
Browse files Browse the repository at this point in the history
  • Loading branch information
kutuzov13 committed Mar 26, 2024
1 parent b269570 commit 6859e03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/api/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from app.api.endpoints.botx import router as bot_router
from app.api.endpoints.healthcheck import router as healthcheck_router
from app.api.endpoints.swagger_rpc_execute import router as swagger_rpc_execute_router
from app.settings import settings

router = APIRouter(include_in_schema=False)

router.include_router(healthcheck_router)
router.include_router(bot_router)

router.include_router(swagger_rpc_execute_router)
if settings.DEBUG:
router.include_router(swagger_rpc_execute_router)
5 changes: 4 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ def get_application(

bot = get_bot(callback_repo)

application = FastAPI()
application = FastAPI(
openapi_url="/openapi.json" if settings.DEBUG else None,
)

application.state.bot = bot

application.add_event_handler("startup", partial(startup, bot))
Expand Down

0 comments on commit 6859e03

Please sign in to comment.