From b54fa13a1de20e2ae54c143449fcd11dbec85afa Mon Sep 17 00:00:00 2001 From: Hamza Masood <47217263+hamza-m-masood@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:34:29 +0100 Subject: [PATCH] fix: added helper function smtp auth for webmodeler (#2245) --- .../templates/web-modeler/_helpers.tpl | 13 +++++++++++++ .../templates/web-modeler/configmap-restapi.yaml | 2 +- .../templates/web-modeler/_helpers.tpl | 13 +++++++++++++ .../templates/web-modeler/configmap-restapi.yaml | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/charts/camunda-platform-alpha/templates/web-modeler/_helpers.tpl b/charts/camunda-platform-alpha/templates/web-modeler/_helpers.tpl index 94fc7211f5..89c93c6c2e 100644 --- a/charts/camunda-platform-alpha/templates/web-modeler/_helpers.tpl +++ b/charts/camunda-platform-alpha/templates/web-modeler/_helpers.tpl @@ -256,6 +256,19 @@ Define match labels for Web Modeler websockets to be used in matchLabels selecto {{- end }} {{- end -}} +{{/* +[web-modeler] Check if username and password is provided for the SMTP server +*/}} +{{- define "webModeler.restapi.mail.authEnabled" -}} + {{- $authEnabled := false -}} + {{- if and (typeIs "string" .Values.webModeler.restapi.mail.smtpUser) (ne .Values.webModeler.restapi.mail.smtpUser "") }} + {{- if or (and (typeIs "string" .Values.webModeler.restapi.mail.smtpPassword) (ne .Values.webModeler.restapi.mail.smtpPassword "")) .Values.webModeler.restapi.mail.existingSecret }} + {{- $authEnabled = true }} + {{- end }} + {{- end }} + {{- $authEnabled -}} +{{- end -}} + {{/* [web-modeler] Get the full name of the Kubernetes objects from the postgresql dependency chart */}} diff --git a/charts/camunda-platform-alpha/templates/web-modeler/configmap-restapi.yaml b/charts/camunda-platform-alpha/templates/web-modeler/configmap-restapi.yaml index 992521596c..fece45d7e1 100644 --- a/charts/camunda-platform-alpha/templates/web-modeler/configmap-restapi.yaml +++ b/charts/camunda-platform-alpha/templates/web-modeler/configmap-restapi.yaml @@ -52,7 +52,7 @@ data: username: {{ .Values.webModeler.restapi.mail.smtpUser | quote }} {{- end }} properties: - mail.smtp.auth: {{ .Values.webModeler.restapi.mail.smtpTlsEnabled }} + mail.smtp.auth: {{ include "webModeler.restapi.mail.authEnabled" . }} mail.smtp.starttls.enable: {{ .Values.webModeler.restapi.mail.smtpTlsEnabled }} mail.smtp.starttls.required: {{ .Values.webModeler.restapi.mail.smtpTlsEnabled }} diff --git a/charts/camunda-platform-latest/templates/web-modeler/_helpers.tpl b/charts/camunda-platform-latest/templates/web-modeler/_helpers.tpl index 94fc7211f5..89c93c6c2e 100644 --- a/charts/camunda-platform-latest/templates/web-modeler/_helpers.tpl +++ b/charts/camunda-platform-latest/templates/web-modeler/_helpers.tpl @@ -256,6 +256,19 @@ Define match labels for Web Modeler websockets to be used in matchLabels selecto {{- end }} {{- end -}} +{{/* +[web-modeler] Check if username and password is provided for the SMTP server +*/}} +{{- define "webModeler.restapi.mail.authEnabled" -}} + {{- $authEnabled := false -}} + {{- if and (typeIs "string" .Values.webModeler.restapi.mail.smtpUser) (ne .Values.webModeler.restapi.mail.smtpUser "") }} + {{- if or (and (typeIs "string" .Values.webModeler.restapi.mail.smtpPassword) (ne .Values.webModeler.restapi.mail.smtpPassword "")) .Values.webModeler.restapi.mail.existingSecret }} + {{- $authEnabled = true }} + {{- end }} + {{- end }} + {{- $authEnabled -}} +{{- end -}} + {{/* [web-modeler] Get the full name of the Kubernetes objects from the postgresql dependency chart */}} diff --git a/charts/camunda-platform-latest/templates/web-modeler/configmap-restapi.yaml b/charts/camunda-platform-latest/templates/web-modeler/configmap-restapi.yaml index 992521596c..fece45d7e1 100644 --- a/charts/camunda-platform-latest/templates/web-modeler/configmap-restapi.yaml +++ b/charts/camunda-platform-latest/templates/web-modeler/configmap-restapi.yaml @@ -52,7 +52,7 @@ data: username: {{ .Values.webModeler.restapi.mail.smtpUser | quote }} {{- end }} properties: - mail.smtp.auth: {{ .Values.webModeler.restapi.mail.smtpTlsEnabled }} + mail.smtp.auth: {{ include "webModeler.restapi.mail.authEnabled" . }} mail.smtp.starttls.enable: {{ .Values.webModeler.restapi.mail.smtpTlsEnabled }} mail.smtp.starttls.required: {{ .Values.webModeler.restapi.mail.smtpTlsEnabled }}