From dbdca7d8d1f2cd2aeac41df85322e30bb0ccb586 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Wed, 24 Jan 2024 15:23:39 +0530 Subject: [PATCH] Disable swagger UI docs in production --- src/khoj/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/khoj/main.py b/src/khoj/main.py index e06f0ff4..b5421979 100644 --- a/src/khoj/main.py +++ b/src/khoj/main.py @@ -45,7 +45,10 @@ with redirect_stdout(collectstatic_output): call_command("collectstatic", "--noinput") # Initialize the Application Server -app = FastAPI() +if os.getenv("KHOJ_DEBUG", "false").lower() == "true": + app = FastAPI(debug=True) +else: + app = FastAPI(docs_url=None) # Disable Swagger UI in production # Get Django Application django_app = get_asgi_application()