Skip to content

Commit

Permalink
Fix external database handling
Browse files Browse the repository at this point in the history
Signed-off-by: fastlorenzo <[email protected]>
  • Loading branch information
fastlorenzo committed Nov 7, 2022
1 parent fbb99a3 commit b2cbe33
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mailu/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
appVersion: "1.9"
version: 1.0.0-beta.9
version: 1.0.0-beta.10
name: mailu
description: This chart installs the Mailu mail system on kubernetes
home: https://mailu.io
Expand Down
6 changes: 3 additions & 3 deletions mailu/templates/_database.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@

{{/* Return the name of the external database */}}
{{- define "mailu.database.external.database" -}}
{{ include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretDatabaseKey "defaultValue" .Values.externalDatabase.database "context" .) }}
{{ (include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretDatabaseKey "defaultValue" .Values.externalDatabase.database "context" .)) | toString | b64dec }}
{{- end -}}

{{/* Return the username of the external database */}}
{{- define "mailu.database.external.username" -}}
{{ include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretUsernameKey "defaultValue" .Values.externalDatabase.username "context" .) }}
{{ (include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretUsernameKey "defaultValue" .Values.externalDatabase.username "context" .)) | toString | b64dec }}
{{- end -}}

{{/* Return the password of the external database */}}
{{- define "mailu.database.external.password" -}}
{{ include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretPasswordKey "defaultValue" .Values.externalDatabase.password "context" .) }}
{{ (include "common.secrets.lookup" (dict "secret" (include "mailu.database.external.secretName" .) "key" .Values.externalDatabase.existingSecretPasswordKey "defaultValue" .Values.externalDatabase.password "context" .)) | toString | b64dec }}
{{- end -}}

{{/* Return the name of the mailu database secret with its credentials */}}
Expand Down
8 changes: 4 additions & 4 deletions mailu/templates/secret-external-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ metadata:
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" . ) | nindent 4 }}
{{- end }}
type: Opaque
stringData:
{{ .Values.externalDatabase.existingSecretDatabaseKey -}}: {{ (include "mailu.database.external.database" . ) | quote }}
{{ .Values.externalDatabase.existingSecretUsernameKey -}}: {{ (include "mailu.database.external.username" . ) | quote }}
{{ .Values.externalDatabase.existingSecretPasswordKey -}}: {{ (include "mailu.database.external.password" . ) | quote }}
data:
{{ .Values.externalDatabase.existingSecretDatabaseKey -}}: {{ (include "mailu.database.external.database" . ) | toString | b64enc | quote }}
{{ .Values.externalDatabase.existingSecretUsernameKey -}}: {{ (include "mailu.database.external.username" . ) | toString | b64enc | quote }}
{{ .Values.externalDatabase.existingSecretPasswordKey -}}: {{ (include "mailu.database.external.password" . ) | toString | b64enc | quote }}
{{- end }}

0 comments on commit b2cbe33

Please sign in to comment.