Skip to content

Commit

Permalink
Merge pull request #1699 from choria-io/1665.19
Browse files Browse the repository at this point in the history
(#1665) allow discovery method and options to be templat parsed
  • Loading branch information
ripienaar authored May 26, 2022
2 parents 5f511e3 + 9576e75 commit 90d60f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 0 additions & 1 deletion providers/appbuilder/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ func (r *RPC) transformResults(w io.Writer, results *replyfmt.RPCResults, action
return err
}

fmt.Printf("transform: %#v", r.def.Transform)
return r.def.Transform.FTransformJSON(r.ctx, w, out.Bytes())
}

Expand Down
14 changes: 14 additions & 0 deletions providers/appbuilder/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ import (
func ProcessStdDiscoveryOptions(f *discovery.StandardOptions, arguments interface{}, flags interface{}, config interface{}) error {
var err error

if f.DiscoveryMethod != "" {
f.DiscoveryMethod, err = builder.ParseStateTemplate(f.DiscoveryMethod, arguments, flags, config)
if err != nil {
return err
}
}

for k, v := range f.DiscoveryOptions {
f.DiscoveryOptions[k], err = builder.ParseStateTemplate(v, arguments, flags, config)
if err != nil {
return err
}
}

if f.Collective != "" {
f.Collective, err = builder.ParseStateTemplate(f.Collective, arguments, flags, config)
if err != nil {
Expand Down

0 comments on commit 90d60f2

Please sign in to comment.