File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,11 @@ import (
4
4
"io"
5
5
"text/template"
6
6
7
- "github.com/Masterminds/sprig/v3"
8
7
"github.com/pkg/errors"
9
8
"github.com/smallstep/certificates/authority"
10
9
authconfig "github.com/smallstep/certificates/authority/config"
11
10
"github.com/smallstep/certificates/authority/provisioner"
11
+ "github.com/smallstep/certificates/templates"
12
12
"go.step.sm/linkedca"
13
13
)
14
14
@@ -24,11 +24,7 @@ type helmVariables struct {
24
24
// WriteHelmTemplate a helm template to configure the
25
25
// smallstep/step-certificates helm chart.
26
26
func (p * PKI ) WriteHelmTemplate (w io.Writer ) error {
27
- funcs := sprig .TxtFuncMap ()
28
- delete (funcs , "env" )
29
- delete (funcs , "expandenv" )
30
-
31
- tmpl , err := template .New ("helm" ).Funcs (funcs ).Parse (helmTemplate )
27
+ tmpl , err := template .New ("helm" ).Funcs (templates .StepFuncMap ()).Parse (helmTemplate )
32
28
if err != nil {
33
29
return errors .Wrap (err , "error writing helm template" )
34
30
}
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ func (t *Template) Load() error {
183
183
// the template fails.
184
184
func (t * Template ) LoadBytes (b []byte ) error {
185
185
t .backfill (b )
186
- tmpl , err := template .New (t .Name ).Funcs (getFuncMap ()).Parse (string (b ))
186
+ tmpl , err := template .New (t .Name ).Funcs (StepFuncMap ()).Parse (string (b ))
187
187
if err != nil {
188
188
return errors .Wrapf (err , "error parsing template %s" , t .Name )
189
189
}
@@ -271,9 +271,9 @@ func mkdir(path string, perm os.FileMode) error {
271
271
return nil
272
272
}
273
273
274
- // getFuncMap returns sprig.TxtFuncMap but removing the "env" and "expandenv"
274
+ // StepFuncMap returns sprig.TxtFuncMap but removing the "env" and "expandenv"
275
275
// functions to avoid any leak of information.
276
- func getFuncMap () template.FuncMap {
276
+ func StepFuncMap () template.FuncMap {
277
277
m := sprig .TxtFuncMap ()
278
278
delete (m , "env" )
279
279
delete (m , "expandenv" )
You can’t perform that action at this time.
0 commit comments