Skip to content

Commit ae9eba3

Browse files
committed
Securitize Swagger
1 parent 4343b1c commit ae9eba3

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

api/src/api/main.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
from api.dependency_container import DependencyContainer
44
from api.workflows.products import product_router
5+
from common.application_environment import ApplicationEnvironment
56

67
DependencyContainer.initialize()
7-
app = FastAPI()
8+
openapi_url = (
9+
"/openapi.json"
10+
if ApplicationEnvironment.get_current() != ApplicationEnvironment.PRODUCTION
11+
else None
12+
)
13+
app = FastAPI(title="Python monorepo", version="0.1.0", openapi_url=openapi_url)
814
app.include_router(product_router.router)
9-
10-
11-
@app.get("/")
12-
async def root() -> str:
13-
return "Hello"

0 commit comments

Comments
 (0)