Skip to content

Commit

Permalink
fix: webhook template should support sprig funcs (#3724)
Browse files Browse the repository at this point in the history
  • Loading branch information
josedonizetti committed Dec 5, 2023
1 parent 723efb7 commit fb7da2f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/cmd/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import (
"io"
"net/http"
"net/url"
"path/filepath"
"strconv"
"strings"
"text/template"
"time"

forward "github.com/IBM/fluent-forward-go/fluent/client"
"github.com/Masterminds/sprig/v3"

"github.com/aquasecurity/tracee/pkg/config"
"github.com/aquasecurity/tracee/pkg/errfmt"
Expand Down Expand Up @@ -644,7 +646,10 @@ func (ws *webhookEventPrinter) Init() error {

gotemplate := getParameterValue(parameters, "gotemplate", "")
if gotemplate != "" {
tmpl, err := template.ParseFiles(gotemplate)
tmpl, err := template.New(filepath.Base(gotemplate)).
Funcs(sprig.TxtFuncMap()).
ParseFiles(gotemplate)

if err != nil {
return errfmt.WrapError(err)
}
Expand Down

0 comments on commit fb7da2f

Please sign in to comment.