From cd84a293ae09a7a01fbb49d3ec2c0b543ad533aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20N=C3=A4gele?= Date: Fri, 22 May 2020 20:10:42 +0200 Subject: [PATCH] Allow hermetic Sprig funtions only (#20) --- README.md | 2 +- pkg/config/config.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 035ee6a..a091f6c 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ backendConfigs: ### Templating Go templating can be used in the config file as follows. -The [Sprig](https://masterminds.github.io/sprig/) function library is included. +Hermetic, i.e. repeatable, functions from the [Sprig](https://masterminds.github.io/sprig/) function library are included. * In the first templating pass, `globalVarFiles`, `globalVars`, `moduleVarFiles`, `moduleVars`, and `envs` are processed. All parameters specified under `params` and using the `-p|--param` flag are available in the `.Params` object. diff --git a/pkg/config/config.go b/pkg/config/config.go index 59796f3..52505b3 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -186,7 +186,7 @@ func load(cfgData []byte) (*fileConfig, error) { func renderTemplate(data map[string]interface{}, tmpl string) (string, error) { wr := strings.Builder{} - tpl := template.New("gotpl").Funcs(sprig.TxtFuncMap()).Option("missingkey=error") + tpl := template.New("gotpl").Funcs(sprig.HermeticTxtFuncMap()).Option("missingkey=error") tpl, err := tpl.Parse(tmpl) if err != nil { return "", err