From 61b5b361925c912b035de17190f74e20b64cb7a3 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 7 Nov 2021 21:39:25 +0100 Subject: [PATCH] core: add command to output full config Signed-off-by: Jens Langhammer --- authentik/core/management/__init__.py | 0 authentik/core/management/commands/__init__.py | 0 authentik/core/management/commands/dump_config.py | 15 +++++++++++++++ website/docs/installation/configuration.md | 10 ++++++++++ website/docs/troubleshooting/login.md | 2 +- 5 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 authentik/core/management/__init__.py create mode 100644 authentik/core/management/commands/__init__.py create mode 100644 authentik/core/management/commands/dump_config.py diff --git a/authentik/core/management/__init__.py b/authentik/core/management/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/authentik/core/management/commands/__init__.py b/authentik/core/management/commands/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/authentik/core/management/commands/dump_config.py b/authentik/core/management/commands/dump_config.py new file mode 100644 index 000000000..fae23a022 --- /dev/null +++ b/authentik/core/management/commands/dump_config.py @@ -0,0 +1,15 @@ +"""Output full config""" +from json import dumps + +from django.core.management.base import BaseCommand, no_translations + +from authentik.lib.config import CONFIG + + +class Command(BaseCommand): # pragma: no cover + """Output full config""" + + @no_translations + def handle(self, *args, **options): + """Check permissions for all apps""" + print(dumps(CONFIG.raw, indent=4)) diff --git a/website/docs/installation/configuration.md b/website/docs/installation/configuration.md index d6908f511..b275b0ad0 100644 --- a/website/docs/installation/configuration.md +++ b/website/docs/installation/configuration.md @@ -152,3 +152,13 @@ Configure how authentik should show avatars for users. Following values can be s - `%(username)s`: The user's username - `%(mail_hash)s`: The email address, md5 hashed - `%(upn)s`: The user's UPN, if set (otherwise an empty string) + +## Debugging + +To check if your config has been applied correctly, you can run the following command to output the full config: + +``` +docker-compose run --rm worker dump_config +# Or for kubernetes +kubectl exec -it deployment/authentik-worker -c authentik -- ak dump_config +``` diff --git a/website/docs/troubleshooting/login.md b/website/docs/troubleshooting/login.md index 5dd68fb63..7379dd6e4 100644 --- a/website/docs/troubleshooting/login.md +++ b/website/docs/troubleshooting/login.md @@ -17,7 +17,7 @@ docker-compose run --rm server create_recovery_key 10 akadmin or, for Kubernetes, run ``` -kubectl exec -it deployment/authentik-web -c authentik -- ak create_recovery_key 10 akadmin +kubectl exec -it deployment/authentik-worker -c authentik -- ak create_recovery_key 10 akadmin ``` This will output a link, that can be used to instantly gain access to authentik as the user specified above. The link is valid for amount of years specified above, in this case, 10 years.