Skip to content

Commit bb37eaa

Browse files
committed
simplify datastore_crypto_key selection logic
1 parent bed1b47 commit bb37eaa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/secrets_datastore_crypto_key.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ type: Opaque
2222
data:
2323
# Datastore key used to encrypt/decrypt record for the KV store
2424
{{- $previous := lookup "v1" "Secret" .Release.Namespace $name }}
25-
{{- if and $previous (not .Values.st2.datastore_crypto_key) }}
26-
datastore_crypto_key: {{ $previous.data.datastore_crypto_key }}
27-
{{- else if .Values.st2.datastore_crypto_key }}
25+
{{- if .Values.st2.datastore_crypto_key }}
2826
datastore_crypto_key: {{ .Values.st2.datastore_crypto_key | b64enc }}
27+
{{- else if $previous }}
28+
datastore_crypto_key: {{ $previous.data.datastore_crypto_key }}
2929
{{- else }}
3030
datastore_crypto_key: {{ tpl (.Files.Get "conf/datastore_crypto_key.yaml") . | fromYaml | toRawJson | b64enc }}
3131
{{- end }}

0 commit comments

Comments
 (0)