fix: disable swagger doc in prod

This commit is contained in:
Timothy J. Baek 2024-01-07 02:48:21 -08:00
parent 70d2571be1
commit 04db2475f9

View file

@ -1,3 +1,5 @@
import time
from fastapi import FastAPI, Request from fastapi import FastAPI, Request
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from fastapi import HTTPException 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.web.main import app as webui_app
from apps.rag.main import app as rag_app from apps.rag.main import app as rag_app
from config import ENV
import time
class SPAStaticFiles(StaticFiles): class SPAStaticFiles(StaticFiles):
@ -27,7 +28,7 @@ class SPAStaticFiles(StaticFiles):
raise ex raise ex
app = FastAPI() app = FastAPI(docs_url="/docs" if ENV == "dev" else None, redoc_url=None)
origins = ["*"] origins = ["*"]