Skip to content

Commit

Permalink
Merge pull request #76 from flanksource/template-interface-values
Browse files Browse the repository at this point in the history
feat: allow structemplater to accept interface{} Values
  • Loading branch information
moshloop authored Oct 20, 2021
2 parents e44afa9 + 51a3806 commit fd94515
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ktemplate/structtemplater.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

type StructTemplater struct {
Values map[string]string
Values map[string]interface{}
Clientset *kubernetes.Clientset
functions *Functions
// IgnoreFields from walking where key is field name and value is field type
Expand Down Expand Up @@ -68,7 +68,7 @@ func (w StructTemplater) Template(val string) (string, error) {
}
for k, v := range w.Values {
_v := v
w.functions.Custom[k] = func() string {
w.functions.Custom[k] = func() interface{} {
return _v
}
}
Expand Down
4 changes: 2 additions & 2 deletions ktemplate/structtemplater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var tests = []test{
{
StructTemplater: StructTemplater{
RequiredTag: "template",
Values: map[string]string{
Values: map[string]interface{}{
"msg": "world",
},
},
Expand All @@ -48,7 +48,7 @@ var tests = []test{
{Left: "{{", Right: "}}"},
{Left: "$(", Right: ")"},
},
Values: map[string]string{
Values: map[string]interface{}{
"msg": "world",
},
ValueFunctions: true,
Expand Down

0 comments on commit fd94515

Please sign in to comment.