only cache API schema in prod

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-09-03 00:00:04 +02:00
parent 31f869c2e0
commit 91c2348b8e
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -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",
),
]
)