From 74df39a93017e88506599c44ef5c71f5bcbe4b57 Mon Sep 17 00:00:00 2001 From: EliseCastle23 Date: Mon, 17 Oct 2022 15:57:06 -0600 Subject: [PATCH] adding a lookup function to lookup the local postgres password for dicom-server --- helm/dicom-server/templates/_helpers.tpl | 12 ++++++++++++ .../dicom-server/templates/config-volume-g3auto.yaml | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/helm/dicom-server/templates/_helpers.tpl b/helm/dicom-server/templates/_helpers.tpl index 64f09687..2bfab706 100644 --- a/helm/dicom-server/templates/_helpers.tpl +++ b/helm/dicom-server/templates/_helpers.tpl @@ -60,4 +60,16 @@ Create the name of the service account to use {{- else }} {{- default "default" .Values.serviceAccount.name }} {{- end }} +{{- end }} + +{{/* + Postgres Password lookup +*/}} +{{- define "dicom.postgres.password" -}} +{{- $localpass := (lookup "v1" "Secret" "postgres" "postgres-postgresql" ) -}} +{{- if $localpass }} +{{- default (index $localpass.data "postgres-password" | b64dec) }} +{{- else }} +{{- default .Values.secrets.password }} +{{- end }} {{- end }} \ No newline at end of file diff --git a/helm/dicom-server/templates/config-volume-g3auto.yaml b/helm/dicom-server/templates/config-volume-g3auto.yaml index 7e744961..dd238b4e 100644 --- a/helm/dicom-server/templates/config-volume-g3auto.yaml +++ b/helm/dicom-server/templates/config-volume-g3auto.yaml @@ -8,7 +8,7 @@ stringData: { "db_host": {{ .Values.secrets.host | quote }}, "db_username": {{ .Values.secrets.userName | quote }}, - "db_password": {{ .Values.secrets.password | quote }}, + "db_password": {{ include "dicom.postgres.password" . | quote }}, "db_database": {{ .Values.secrets.dataBase | quote }} } orthanc_config_overwrites.json: | @@ -21,7 +21,7 @@ stringData: "Host": {{ .Values.secrets.host | quote }}, "Database": {{ .Values.secrets.dataBase | quote }}, "Username": {{ .Values.secrets.userName | quote }}, - "Password": {{ .Values.secrets.password | quote }}, + "Password": {{ include "dicom.postgres.password" . | quote }}, "IndexConnectionsCount": {{ .Values.secrets.indexConnectionsCount }}, "Lock": {{ .Values.secrets.lock }} },