add {{env.VARNAME}} template support to allow use of env vars

This commit is contained in:
Cory Bennett
2017-10-03 18:47:33 -04:00
parent 172793ea69
commit 4d74554300
+8
View File
@@ -65,6 +65,14 @@ func TemplateProcessor() *template.Template {
"jira": func() string {
return os.Args[0]
},
"env": func() map[string]string {
out := map[string]string{}
for _, env := range os.Environ() {
kv := strings.SplitN(env, "=", 2)
out[kv[0]] = kv[1]
}
return out
},
"toJson": func(content interface{}) (string, error) {
bytes, err := json.MarshalIndent(content, "", " ")
if err != nil {