diff options
Diffstat (limited to 'templater')
-rw-r--r-- | templater/templater.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/templater/templater.go b/templater/templater.go index 192aac849804..ff4e0efde7b2 100644 --- a/templater/templater.go +++ b/templater/templater.go @@ -203,7 +203,13 @@ func templateFuncs(c *context.Context, rs *context.ResourceSet) template.FuncMap return string(data), nil } + m["default"] = func(defaultVal interface{}, varName string) interface{} { + if val, ok := rs.Values[varName]; ok { + return val + } + return defaultVal + } return m } |