mirror of
https://github.com/rancher/rke.git
synced 2025-09-20 02:49:08 +00:00
16 lines
339 B
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
|
||
|
}
|