helm-charts/charts/library/common/templates/lib/routes/_enabled_routes.tpl
2025-03-14 09:38:35 +00:00

23 lines
640 B
Smarty

{{/*
Return the enabled routes.
*/}}
{{- define "bjw-s.common.lib.route.enabledRoutes" -}}
{{- $rootContext := .rootContext -}}
{{- $enabledRoutes := dict -}}
{{- range $name, $route := $rootContext.Values.route -}}
{{- if kindIs "map" $route -}}
{{- /* Enable Route by default, but allow override */ -}}
{{- $routeEnabled := true -}}
{{- if hasKey $route "enabled" -}}
{{- $routeEnabled = $route.enabled -}}
{{- end -}}
{{- if $routeEnabled -}}
{{- $_ := set $enabledRoutes $name . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $enabledRoutes | toYaml -}}
{{- end -}}