Skip to content

Commit

Permalink
Always decorate sprig funcs with sprig_
Browse files Browse the repository at this point in the history
  • Loading branch information
angrycub committed Jan 24, 2022
1 parent e384115 commit 399d853
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 8 additions & 0 deletions docs/templating-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ provides the following functions:
- [toUpper](#toupper)
- [toYAML](#toyaml)
- [sockaddr](#sockaddr)
- [Sprig Functions](#sprig-functions)
- [Math Functions](#math-functions)
- [add](#add)
- [subtract](#subtract)
Expand Down Expand Up @@ -1518,6 +1519,13 @@ for more information.

---

## Sprig Functions

Consul-template provides access to the Sprig library
in templates. To use a Sprig function in your template, prepend `sprig_` to the function name. A full list of Sprig functions can be found in the [Sprig Function Documentation](http://masterminds.github.io/sprig/)

---

## Math Functions

The following functions are available on floats and integer values.
Expand Down
6 changes: 1 addition & 5 deletions template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,7 @@ func funcMap(i *funcMapInput) template.FuncMap {

// Add the Sprig functions to the funcmap
for k, v := range sprig.FuncMap() {
target := k
if r[target] != nil {
// Decorate function names that conflict
target = target + "_sprig"
}
target := "sprig_" + k
r[target] = v
}

Expand Down

0 comments on commit 399d853

Please sign in to comment.