From a32542d6b734f09fd9fcb300ce2e204a1a577765 Mon Sep 17 00:00:00 2001 From: Amund Isaksen <31344542+Teddy-1000@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:59:50 +0100 Subject: [PATCH] Add configureable root path (#216) --- api/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/main.py b/api/main.py index 25490db4..eb9cf955 100644 --- a/api/main.py +++ b/api/main.py @@ -1,6 +1,7 @@ # Run with: # For developing: uvicorn main:app --reload import logging +import os import metadata_endpoints from brotli_asgi import BrotliMiddleware @@ -30,7 +31,10 @@ def setup_logging(): logger = logging.getLogger(__name__) -app = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True}) +app = FastAPI( + swagger_ui_parameters={"tryItOutEnabled": True}, + root_path=os.getenv("FASTAPI_ROOT_PATH", ""), +) app.add_middleware(BrotliMiddleware) add_metrics(app)