@@ -6,11 +6,11 @@ import (
6
6
"fmt"
7
7
"net/url"
8
8
"strings"
9
- "text/template"
10
9
11
10
"github.com/ovh/configstore"
12
11
"github.com/ovh/go-ovh/ovh"
13
12
13
+ "github.com/ovh/utask/engine/values"
14
14
"github.com/ovh/utask/pkg/plugins/builtin/httputil"
15
15
"github.com/ovh/utask/pkg/plugins/taskplugin"
16
16
"github.com/ovh/utask/pkg/utils"
@@ -55,7 +55,7 @@ func validConfig(config interface{}) error {
55
55
return fmt .Errorf ("unknown method for gw runner: %q" , cfg .Method )
56
56
}
57
57
// If the API credentials is a template, try to parse it.
58
- if strings .Index (cfg .Credentials , "{{" ) == - 1 {
58
+ if ! strings .Contains (cfg .Credentials , "{{" ) {
59
59
ovhCfgStr , err := configstore .GetItemValue (cfg .Credentials )
60
60
if err != nil {
61
61
return fmt .Errorf ("can't retrieve credentials from configstore: %s" , err )
@@ -74,7 +74,8 @@ func validConfig(config interface{}) error {
74
74
return fmt .Errorf ("can't create new OVH client: %s" , err )
75
75
}
76
76
} else {
77
- if _ , err := template .New ("credentials" ).Parse (cfg .Credentials ); err != nil {
77
+ v := values .NewValues ()
78
+ if _ , err := v .Apply (cfg .Credentials , nil , "" ); err != nil {
78
79
return fmt .Errorf ("failed to parse credentials template: %w" , err )
79
80
}
80
81
}
0 commit comments