@@ -36,14 +36,14 @@ func (t TLSConfig) IsEmpty() bool {
36
36
type HTTPConnection struct {
37
37
ConnectionName string `json:"connection,omitempty" yaml:"connection,omitempty"`
38
38
types.Authentication `json:",inline"`
39
- URL types. EnvVar `json:"url,omitempty" yaml:"url,omitempty"`
39
+ URL string `json:"url,omitempty" yaml:"url,omitempty"`
40
40
Bearer types.EnvVar `json:"bearer,omitempty" yaml:"bearer,omitempty"`
41
41
OAuth types.OAuth `json:"oauth,omitempty" yaml:"oauth,omitempty"`
42
42
TLS TLSConfig `json:"tls,omitempty" yaml:"tls,omitempty"`
43
43
}
44
44
45
45
func (h HTTPConnection ) GetEndpoint () string {
46
- return h .URL . String ()
46
+ return h .URL
47
47
}
48
48
49
49
func (h * HTTPConnection ) Hydrate (ctx ConnectionContext , namespace string ) (* HTTPConnection , error ) {
@@ -62,7 +62,13 @@ func (h *HTTPConnection) Hydrate(ctx ConnectionContext, namespace string) (*HTTP
62
62
}
63
63
}
64
64
65
- h .URL .ValueStatic , err = ctx .GetEnvValueFromCache (h .URL , namespace )
65
+ // URL can be an EnvVar string so we
66
+ // typecase to EnvVar and scan it first
67
+ var url types.EnvVar
68
+ if err := url .Scan (h .URL ); err != nil {
69
+ return h , err
70
+ }
71
+ h .URL , err = ctx .GetEnvValueFromCache (url , namespace )
66
72
if err != nil {
67
73
return h , err
68
74
}
@@ -142,9 +148,6 @@ func NewHTTPConnection(ctx ConnectionContext, conn models.Connection) (HTTPConne
142
148
var httpConn HTTPConnection
143
149
switch conn .Type {
144
150
case models .ConnectionTypeHTTP :
145
- if err := httpConn .URL .Scan (conn .URL ); err != nil {
146
- return httpConn , fmt .Errorf ("error scanning url: %w" , err )
147
- }
148
151
if err := httpConn .Username .Scan (conn .Username ); err != nil {
149
152
return httpConn , fmt .Errorf ("error scanning username: %w" , err )
150
153
}
0 commit comments