From 04db2475f9e7007463522000bcf003a017a5c299 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 7 Jan 2024 02:48:21 -0800 Subject: [PATCH] fix: disable swagger doc in prod --- backend/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/main.py b/backend/main.py index b682aad2..e4d4bdb5 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1,3 +1,5 @@ +import time + from fastapi import FastAPI, Request from fastapi.staticfiles import StaticFiles from fastapi import HTTPException @@ -12,8 +14,7 @@ from apps.openai.main import app as openai_app from apps.web.main import app as webui_app from apps.rag.main import app as rag_app - -import time +from config import ENV class SPAStaticFiles(StaticFiles): @@ -27,7 +28,7 @@ class SPAStaticFiles(StaticFiles): raise ex -app = FastAPI() +app = FastAPI(docs_url="/docs" if ENV == "dev" else None, redoc_url=None) origins = ["*"]