api: cache schema, fix server urls

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-03 10:08:19 +02:00
parent 5c1d27de2b
commit c2b9dc5c75
3 changed files with 7 additions and 7 deletions

View File

@ -1,6 +1,6 @@
"""api v3 urls""" """api v3 urls"""
from django.urls import path from django.urls import path
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.cache import cache_page
from drf_spectacular.views import SpectacularAPIView from drf_spectacular.views import SpectacularAPIView
from rest_framework import routers from rest_framework import routers
@ -225,7 +225,7 @@ urlpatterns = (
FlowExecutorView.as_view(), FlowExecutorView.as_view(),
name="flow-executor", name="flow-executor",
), ),
path("sentry/", csrf_exempt(SentryTunnelView.as_view()), name="sentry"), path("sentry/", SentryTunnelView.as_view(), name="sentry"),
path("schema/", SpectacularAPIView.as_view(), name="schema"), path("schema/", cache_page(86400)(SpectacularAPIView.as_view()), name="schema"),
] ]
) )

View File

@ -154,10 +154,10 @@ SPECTACULAR_SETTINGS = {
"SCHEMA_PATH_PREFIX_TRIM": True, "SCHEMA_PATH_PREFIX_TRIM": True,
"SERVERS": [ "SERVERS": [
{ {
"url": "http://authentik.tld/api/v3/", "url": "/api/v3/",
}, },
{ {
"url": "http://authentik.tld/api/v2beta/", "url": "/api/v2beta/",
}, },
], ],
"CONTACT": { "CONTACT": {

View File

@ -29105,5 +29105,5 @@ components:
in: header in: header
name: Authorization name: Authorization
servers: servers:
- url: http://authentik.tld/api/v3/ - url: /api/v3/
- url: http://authentik.tld/api/v2beta/ - url: /api/v2beta/