Skip to content

Commit

Permalink
Merge pull request #10 from fastlorenzo/refactor
Browse files Browse the repository at this point in the history
Fix external database handling
  • Loading branch information
fastlorenzo authored Nov 7, 2022
2 parents ac0ef44 + c2f739a commit d707d37
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/notify-on-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
release:
types: [published]

jobs:
send-message:
runs-on: ubuntu-latest
name: Send message via Matrix
steps:
- name: Send message to mailu-helm-chart channel
id: matrix-chat-message
uses: fadenb/[email protected]
with:
homeserver: 'matrix.org'
token: ${{ secrets.MATRIX_TOKEN }}
channel: '!KluZWhQwHDYrOfqJdD:make-it.fr'
message: |
# New release of mailu-helm-chart
\
Version: **${{ github.event.release.tag_name }}**\
URL: **${{ github.event.release.html_url }}**\
\
Description:\
```${{ github.event.release.body }}```
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 d707d37

Please sign in to comment.