mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
29 lines
1.1 KiB
Smarty
29 lines
1.1 KiB
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 -}}
|
|
|
|
{{- range $identifier, $objectValues := $enabledRoutes -}}
|
|
{{- $object := include "bjw-s.common.lib.valuesToObject" (dict "rootContext" $rootContext "id" $identifier "values" $objectValues "itemCount" (len $enabledRoutes)) | fromYaml -}}
|
|
{{- $object = include "bjw-s.common.lib.route.autoDetectService" (dict "rootContext" $rootContext "object" $object) | fromYaml -}}
|
|
{{- $_ := set $enabledRoutes $identifier $object -}}
|
|
{{- end -}}
|
|
|
|
{{- $enabledRoutes | toYaml -}}
|
|
{{- end -}}
|