Files
capsule/pkg/template/functions/funcmap.go
T
cc4fb45d70 feat: upstream enterprise preview (#1841)
feat: upstream enterprise preview

---------

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
Co-authored-by: CorentinPtrl <pitrel.corentin@gmail.com>
2026-05-28 00:58:58 +02:00

37 lines
866 B
Go

// Copyright 2020-2026 Project Capsule Authors
// SPDX-License-Identifier: Apache-2.0
package functions
import (
"maps"
"text/template"
"github.com/go-sprout/sprout/sprigin"
)
// TxtFuncMap returns an aggregated template function map. Currently (custom functions + sprig).
func ExtraFuncMap() template.FuncMap {
funcMap := sprigin.FuncMap()
maps.Copy(funcMap, CustomFuncMap())
// Remove unsafe methods
delete(funcMap, "env")
delete(funcMap, "expandEnv")
return funcMap
}
// CustomFuncMap return our custom templates.
func CustomFuncMap() template.FuncMap {
return template.FuncMap{
"toToml": toTOML,
"fromToml": fromTOML,
"fromYamlArray": fromYAMLArray,
"fromJsonArray": fromJSONArray,
"deterministicUUID": deterministicUUID,
"generateAgeKey": generateAgeKey,
"generateAgePQKey": generateAgePQKey,
}
}