From b0efab6d6dd19006568b463faff73220d04f79f9 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 24 Aug 2021 10:55:46 +0200 Subject: [PATCH] admin: add env to API Signed-off-by: Jens Langhammer --- authentik/admin/api/system.py | 5 +++++ schema.yml | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/authentik/admin/api/system.py b/authentik/admin/api/system.py index 398ddee03..51c2adf1f 100644 --- a/authentik/admin/api/system.py +++ b/authentik/admin/api/system.py @@ -34,6 +34,7 @@ class RuntimeDict(TypedDict): class SystemSerializer(PassiveSerializer): """Get system information.""" + env = SerializerMethodField() http_headers = SerializerMethodField() http_host = SerializerMethodField() http_is_secure = SerializerMethodField() @@ -42,6 +43,10 @@ class SystemSerializer(PassiveSerializer): server_time = SerializerMethodField() embedded_outpost_host = SerializerMethodField() + def get_env(self, request: Request) -> dict[str, str]: + """Get Environment""" + return os.environ + def get_http_headers(self, request: Request) -> dict[str, str]: """Get HTTP Request headers""" headers = {} diff --git a/schema.yml b/schema.yml index 421488100..5ce5d85f7 100644 --- a/schema.yml +++ b/schema.yml @@ -29822,6 +29822,11 @@ components: type: object description: Get system information. properties: + env: + type: object + additionalProperties: + type: string + readOnly: true http_headers: type: object additionalProperties: @@ -29861,6 +29866,7 @@ components: readOnly: true required: - embedded_outpost_host + - env - http_headers - http_host - http_is_secure