fix(monica): only b64enc the key once (#1930)

* fix(monica): only b64enc the key once

* Restore description

* Update _appkey.tpl

Co-authored-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
This commit is contained in:
Stavros Kois
2022-02-22 12:24:26 +02:00
committed by GitHub
parent 37a96dd1e7
commit ae63bcea40
3 changed files with 9 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ name: monica
sources:
- https://github.com/monicahq/monica
- https://hub.docker.com/_/monica
version: 0.0.43
version: 0.0.44
annotations:
truecharts.org/catagories: |
- crm

View File

@@ -1,23 +1,22 @@
{{/*
This template generates a random password and ensures it persists across updates/edits to the chart
This template generates a random appkey and ensures it persists across updates/edits to the chart
*/}}
{{- define "monica.appkey" -}}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: appkey
labels:
{{- include "common.labels" . | nindent 4 }}
name: appkey
{{- $keyprevious := lookup "v1" "Secret" .Release.Namespace "appkey" }}
{{- $appkey := "" }}
data:
{{- if $keyprevious }}
{{- $appkey = ( index $keyprevious.data "appkey" ) | b64dec }}
{{- if $keyprevious }}
appkey: {{ ( index $keyprevious.data "appkey" ) }}
{{- else }}
{{- $appkey = randAlphaNum 32 | b64enc }}
appkey: {{ $appkey | b64enc | quote }}
{{- end }}
type: Opaque
{{- else }}
{{- $appkey = randAlphaNum 32 }}
appkey: {{ $appkey | b64enc }}
{{- end }}
{{- end -}}

View File

@@ -4,6 +4,5 @@
{{/* Render appkey for monica */}}
{{- include "monica.appkey" . }}
{{/* Render the templates */}}
{{ include "common.postSetup" . }}