From 0283c9fe55cf54ac7590e1a47416a5d9c998ec8e Mon Sep 17 00:00:00 2001 From: Francesco Bartoli Date: Sun, 7 Apr 2024 01:05:03 +0200 Subject: [PATCH] Fix public paths for api-key protection --- app/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index b251a9c..22b6775 100644 --- a/app/main.py +++ b/app/main.py @@ -166,7 +166,9 @@ async def custom_app_exception_handler(request, e): os.environ["PYGEOAPI_KEY_GLOBAL"] = cfg.PYGEOAPI_KEY_GLOBAL PYGEOAPI_APP.add_middleware( - AuthorizerMiddleware, public_paths=["/openapi"], key_pattern="PYGEOAPI_KEY_" + AuthorizerMiddleware, + public_paths=[f"{cfg.FASTGEOAPI_CONTEXT}/openapi"], + key_pattern="PYGEOAPI_KEY_", ) security_schemes = [