From 4737ed22b2e1d64d9023dc2a3ba5892eb7c9e064 Mon Sep 17 00:00:00 2001 From: Jiri Tyr Date: Mon, 27 Feb 2023 22:15:29 +0000 Subject: [PATCH] Adding getEnv templating function Signed-off-by: Jiri Tyr --- pkg/template/template.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/template/template.go b/pkg/template/template.go index a180cf1..648ae7d 100644 --- a/pkg/template/template.go +++ b/pkg/template/template.go @@ -15,6 +15,7 @@ package template import ( "bytes" + "os" "regexp" "strings" "text/template" @@ -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.