From 289f176abfb796f29c7c0828c108176ac150deec Mon Sep 17 00:00:00 2001 From: Sven Ketelsen Date: Fri, 3 Jun 2022 14:42:07 +0200 Subject: [PATCH] feat: secrets --- smardigo/templates/connect/secret.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/smardigo/templates/connect/secret.yml b/smardigo/templates/connect/secret.yml index 810e7ca..385ceb6 100644 --- a/smardigo/templates/connect/secret.yml +++ b/smardigo/templates/connect/secret.yml @@ -13,12 +13,17 @@ data: {{- $old_sec := lookup "v1" "Secret" .Release.Namespace $secret_name }} # check, if a secret is already set - {{- if or (or (not $old_sec) (not $old_sec.data)) (not (index $old_sec.data.JWT_SECRET)) }} + {{- if or (not $old_sec) (not $old_sec.data) }} + {{- if (index $old_sec.data "JWT_SECRET") }} + # if set, then use the old value + JWT_SECRET: {{ index $old_sec.data "JWT_SECRET" }} + {{ else }} # if not set, then generate a new password JWT_SECRET: {{ randAlphaNum 32 | b64enc }} + {{ end }} {{ else }} - # if set, then use the old value - JWT_SECRET: {{ index $old_sec.data "JWT_SECRET" }} + # if not set, then generate a new password + JWT_SECRET: {{ randAlphaNum 32 | b64enc }} {{ end }} ADMIN_PASSWORD: "{{ .Values.connect.database.password | b64enc}}"