From 91c2348b8ed1d69944fd242695fd15760fb86e8e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 3 Sep 2023 00:00:04 +0200 Subject: [PATCH] only cache API schema in prod Signed-off-by: Jens Langhammer --- authentik/api/v3/urls.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/authentik/api/v3/urls.py b/authentik/api/v3/urls.py index a7e610efa..4d00cf630 100644 --- a/authentik/api/v3/urls.py +++ b/authentik/api/v3/urls.py @@ -11,6 +11,7 @@ from structlog.stdlib import get_logger from authentik.api.v3.config import ConfigView from authentik.api.views import APIBrowserView from authentik.lib.utils.reflection import get_apps +from django.conf import settings LOGGER = get_logger() @@ -52,6 +53,10 @@ urlpatterns = ( + _other_urls + [ path("root/config/", ConfigView.as_view(), name="config"), - path("schema/", cache_page(86400)(SpectacularAPIView.as_view()), name="schema"), + path( + "schema/", + cache_page(0 if settings.DEBUG else 86400)(SpectacularAPIView.as_view()), + name="schema", + ), ] )