Skip to content

Commit

Permalink
Merge pull request #9 from yangwu1227/disable-swagger-ui
Browse files Browse the repository at this point in the history
refactor: keep swagger ui for dev but disable in prod
  • Loading branch information
yangwu1227 authored Sep 18, 2024
2 parents ee1ce44 + 9e384e1 commit 4f7a9a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
environment:
- ENVIRONMENT=dev
- TESTING=0
- ENABLE_DOCS=/docs
- DATABASE_URL=postgres://postgres:postgres@web-db:5432/web_dev
- DATABASE_TEST_URL=postgres://postgres:postgres@web-db:5432/web_test

Expand Down
8 changes: 7 additions & 1 deletion project/app/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os

from fastapi import FastAPI

Expand All @@ -9,7 +10,12 @@


def create_app() -> FastAPI:
application = FastAPI(title="text-summarizer", lifespan=lifespan)
application = FastAPI(
title="text-summarizer",
lifespan=lifespan,
docs_url=os.getenv("ENABLE_DOCS", None),
redoc_url=None,
)
application.include_router(ping.router)
application.include_router(summaries.router, prefix="/summaries", tags=["summaries"])
return application
Expand Down

0 comments on commit 4f7a9a0

Please sign in to comment.