Skip to content

Commit

Permalink
root: ensure consistent install_id (cherry-pick #8775) (#8776)
Browse files Browse the repository at this point in the history
Co-authored-by: Jens L <jens@goauthentik.io>
  • Loading branch information
gcp-cherry-pick-bot[bot] and BeryJu authored Mar 1, 2024
1 parent 76f4d7f commit f74549b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions authentik/root/install_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from authentik.lib.config import CONFIG

QUERY = """SELECT id FROM public.authentik_install_id ORDER BY id LIMIT 1;"""


@lru_cache
def get_install_id() -> str:
Expand All @@ -18,7 +20,7 @@ def get_install_id() -> str:
if settings.TEST:
return str(uuid4())
with connection.cursor() as cursor:
cursor.execute("SELECT id FROM public.authentik_install_id LIMIT 1;")
cursor.execute(QUERY)
return cursor.fetchone()[0]


Expand All @@ -38,5 +40,5 @@ def get_install_id_raw():
sslkey=CONFIG.get("postgresql.sslkey"),
)
cursor = conn.cursor()
cursor.execute("SELECT id FROM public.authentik_install_id LIMIT 1;")
cursor.execute(QUERY)
return cursor.fetchone()[0]

0 comments on commit f74549b

Please sign in to comment.