delete embedded outpost if it is disabled

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2023-12-04 07:42:39 +01:00
parent d28c58adca
commit e14f1e2cfb
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
1 changed files with 22 additions and 18 deletions

View File

@ -3,6 +3,7 @@ from prometheus_client import Gauge
from structlog.stdlib import get_logger from structlog.stdlib import get_logger
from authentik.blueprints.apps import ManagedAppConfig from authentik.blueprints.apps import ManagedAppConfig
from authentik.lib.config import CONFIG
LOGGER = get_logger() LOGGER = get_logger()
@ -39,6 +40,7 @@ class AuthentikOutpostConfig(ManagedAppConfig):
OutpostType, OutpostType,
) )
if CONFIG.get_bool("outposts.disable_embedded_outpost", False):
outpost, updated = Outpost.objects.update_or_create( outpost, updated = Outpost.objects.update_or_create(
defaults={ defaults={
"name": "authentik Embedded Outpost", "name": "authentik Embedded Outpost",
@ -58,3 +60,5 @@ class AuthentikOutpostConfig(ManagedAppConfig):
] ]
) )
outpost.save() outpost.save()
else:
Outpost.objects.delete(managed=MANAGED_OUTPOST)