2021-11-30 13:33:15 +00:00
|
|
|
{{/*
|
2022-02-22 10:24:26 +00:00
|
|
|
This template generates a random appkey and ensures it persists across updates/edits to the chart
|
2021-11-30 13:33:15 +00:00
|
|
|
*/}}
|
|
|
|
{{- define "monica.appkey" -}}
|
2023-04-29 06:44:01 +00:00
|
|
|
enabled: true
|
|
|
|
{{- $basename := include "tc.v1.common.lib.chart.names.fullname" $ -}}
|
|
|
|
{{- $fetchname := printf "%s-appkey" $basename -}}
|
|
|
|
{{- $keyprevious := lookup "v1" "Secret" .Release.Namespace $fetchname }}
|
2021-11-30 13:33:15 +00:00
|
|
|
{{- $appkey := "" }}
|
|
|
|
data:
|
2022-02-22 10:24:26 +00:00
|
|
|
{{- if $keyprevious }}
|
2023-04-29 06:44:01 +00:00
|
|
|
appkey: {{ ( index $keyprevious.data "appkey" ) | b64dec }}
|
2022-02-22 10:24:26 +00:00
|
|
|
{{- else }}
|
|
|
|
{{- $appkey = randAlphaNum 32 }}
|
2023-04-29 06:44:01 +00:00
|
|
|
appkey: {{ $appkey }}
|
2022-02-22 10:24:26 +00:00
|
|
|
{{- end }}
|
2021-11-30 13:33:15 +00:00
|
|
|
{{- end -}}
|