Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: keep swagger ui for dev but disable in prod #9

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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