Skip to content

Commit 1c6bb3f

Browse files
refactor: handle unconfigured stores in getStoreByType
Make getStoreByType return an empty dict when the store isn't configured, removing the need for special-case logic in eachStore. This treats secondaryVisibility consistently with other stores. This change: - Adds a check in getStoreByType to return empty dict if storeName is nil - Simplifies eachStore to use getStoreByType for all stores including secondary - Makes secondary visibility less of an exceptional case
1 parent a86192a commit 1c6bb3f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

charts/temporal/templates/_helpers.tpl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ app.kubernetes.io/part-of: {{ $global.Chart.Name }}
171171
{{- $stores := dict -}}
172172
{{- $_ := set $stores "default" (include "temporal.persistence.getStoreByType" (list $ "default") | fromYaml) -}}
173173
{{- $_ := set $stores "visibility" (include "temporal.persistence.getStoreByType" (list $ "visibility") | fromYaml) -}}
174-
{{- if .Values.server.config.persistence.secondaryVisibilityStore -}}
175-
{{- $secondaryVisibilityStoreName := .Values.server.config.persistence.secondaryVisibilityStore -}}
176-
{{- $_ := set $stores "secondaryVisibility" (include "temporal.persistence.getStore" (list $ $secondaryVisibilityStoreName) | fromYaml) -}}
174+
{{- $secondaryVisibility := include "temporal.persistence.getStoreByType" (list $ "secondaryVisibility") | fromYaml -}}
175+
{{- if $secondaryVisibility -}}
176+
{{- $_ := set $stores "secondaryVisibility" $secondaryVisibility -}}
177177
{{- end -}}
178178
{{- $stores | toYaml -}}
179179
{{- end -}}
@@ -221,7 +221,11 @@ app.kubernetes.io/part-of: {{ $global.Chart.Name }}
221221
{{- $root := index . 0 -}}
222222
{{- $type := index . 1 -}}
223223
{{- $storeName := get $root.Values.server.config.persistence (printf "%sStore" $type) -}}
224+
{{- if $storeName -}}
224225
{{- include "temporal.persistence.getStore" (list $root $storeName) -}}
226+
{{- else -}}
227+
{{- dict | toYaml -}}
228+
{{- end -}}
225229
{{- end -}}
226230

227231
{{- define "temporal.persistence.schema" -}}

0 commit comments

Comments
 (0)