Skip to content

Commit

Permalink
Adding getEnv templating function (#153)
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Tyr <[email protected]>
  • Loading branch information
jtyr authored Apr 25, 2023
1 parent 6463176 commit 8a9dde1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package template

import (
"bytes"
"os"
"regexp"
"strings"
"text/template"
Expand Down Expand Up @@ -47,6 +48,9 @@ var funcs = template.FuncMap{
"stringSlice": func(s ...string) []string {
return s
},
"getEnv": func(name string) string {
return os.Getenv(name)
},
}

// LoadTemplate reads and parses all templates defined in the given file and constructs a jiralert.Template.
Expand Down

0 comments on commit 8a9dde1

Please sign in to comment.