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 11:24:26 +01:00
committed by GitHub
co-authored by Kjeld Schouten-Lebbing
parent 37a96dd1e7
commit ae63bcea40
3 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ name: monica
sources: sources:
- https://github.com/monicahq/monica - https://github.com/monicahq/monica
- https://hub.docker.com/_/monica - https://hub.docker.com/_/monica
version: 0.0.43 version: 0.0.44
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- crm - crm
+8 -9
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" -}} {{- define "monica.appkey" -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
type: Opaque
metadata: metadata:
name: appkey
labels: labels:
{{- include "common.labels" . | nindent 4 }} {{- include "common.labels" . | nindent 4 }}
name: appkey
{{- $keyprevious := lookup "v1" "Secret" .Release.Namespace "appkey" }} {{- $keyprevious := lookup "v1" "Secret" .Release.Namespace "appkey" }}
{{- $appkey := "" }} {{- $appkey := "" }}
data: data:
{{- if $keyprevious }} {{- if $keyprevious }}
{{- $appkey = ( index $keyprevious.data "appkey" ) | b64dec }}
appkey: {{ ( index $keyprevious.data "appkey" ) }} appkey: {{ ( index $keyprevious.data "appkey" ) }}
{{- else }} {{- else }}
{{- $appkey = randAlphaNum 32 | b64enc }} {{- $appkey = randAlphaNum 32 }}
appkey: {{ $appkey | b64enc | quote }} appkey: {{ $appkey | b64enc }}
{{- end }} {{- end }}
type: Opaque
{{- end -}} {{- end -}}
@@ -4,6 +4,5 @@
{{/* Render appkey for monica */}} {{/* Render appkey for monica */}}
{{- include "monica.appkey" . }} {{- include "monica.appkey" . }}
{{/* Render the templates */}} {{/* Render the templates */}}
{{ include "common.postSetup" . }} {{ include "common.postSetup" . }}