File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -22,13 +22,17 @@ def configure_logging() -> None:
2222configure_logging ()
2323logger = logging .getLogger (__name__ )
2424
25+ environment = os .getenv ("ENVIRONMENT" , "dev" ).lower ()
26+ hide_docs = environment .startswith ("prod" )
27+
2528# FastAPI μ± μμ±
2629app = FastAPI (
2730 title = "PseudoLab μλ£μ¦ λ°κΈ μμ€ν
" ,
2831 description = "PseudoLab μλ£μ¦ λ°κΈμ μν API μλ²" ,
2932 version = "1.0.0" ,
30- docs_url = "/docs" ,
31- redoc_url = "/redoc" ,
33+ docs_url = None if hide_docs else "/docs" ,
34+ redoc_url = None if hide_docs else "/redoc" ,
35+ openapi_url = None if hide_docs else "/openapi.json" ,
3236)
3337
3438# CORS λ―Έλ€μ¨μ΄ μ€μ
Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ services:
5858 - traefik.docker.network=traefik
5959
6060 # --- Traefik Router (backend) ---
61- - traefik.http.routers.cert-${ENVIRONMENT}-api.rule=Host(`${APP_HOST}`) && (PathPrefix(`/api`) || PathPrefix(`/docs`) || PathPrefix(`/redoc`) || PathPrefix(`/health`) || Path(`/openapi.json`))
61+ # Docs/Redoc/OpenAPI κ²½λ‘λ λΌμ°ν
νλ, λ°±μλμμ prod νκ²½μμλ λΉνμ±νλλ€.
62+ - traefik.http.routers.cert-${ENVIRONMENT}-api.rule=Host(`${APP_HOST}`) && (PathPrefix(`/api`) || PathPrefix(`/health`) || PathPrefix(`/docs`) || PathPrefix(`/redoc`) || Path(`/openapi.json`))
6263 - traefik.http.routers.cert-${ENVIRONMENT}-api.entrypoints=websecure
6364 - traefik.http.routers.cert-${ENVIRONMENT}-api.tls=true
6465 - traefik.http.routers.cert-${ENVIRONMENT}-api.tls.certresolver=le
You canβt perform that action at this time.
0 commit comments