1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-16 06:59:25 +00:00
Files
rke/templates/templates.go

16 lines
339 B
Go

package templates
import (
"bytes"
"text/template"
)
func CompileTemplateFromMap(tmplt string, configMap map[string]string) (string, error) {
out := new(bytes.Buffer)
t := template.Must(template.New("compiled_template").Parse(tmplt))
if err := t.Execute(out, configMap); err != nil {
return "", err
}
return out.String(), nil
}