@@ -3,6 +3,7 @@ package codefresh
33import (
44 "bytes"
55 "context"
6+ "crypto/tls"
67 "encoding/json"
78 "errors"
89 "fmt"
3132 Argo () ArgoAPI
3233 Gitops () GitopsAPI
3334 V2 () V2API
34- AppProxy (ctx context.Context , runtime string ) (AppProxyAPI , error )
35+ AppProxy (ctx context.Context , runtime string , insecure bool ) (AppProxyAPI , error )
3536 }
3637
3738 V2API interface {
@@ -121,7 +122,7 @@ func (c *codefresh) CliReleases() ICliReleasesAPI {
121122 return newCliReleasesAPI (c )
122123}
123124
124- func (c * codefresh ) AppProxy (ctx context.Context , runtime string ) (AppProxyAPI , error ) {
125+ func (c * codefresh ) AppProxy (ctx context.Context , runtime string , insecure bool ) (AppProxyAPI , error ) {
125126 rt , err := c .V2 ().Runtime ().Get (ctx , runtime )
126127 if err != nil {
127128 return nil , fmt .Errorf ("failed to create app-proxy client for runtime %s: %w" , runtime , err )
@@ -131,10 +132,18 @@ func (c *codefresh) AppProxy(ctx context.Context, runtime string) (AppProxyAPI,
131132 return nil , fmt .Errorf ("failed to create app-proxy client for runtime %s: runtime does not have ingressHost configured" , runtime )
132133 }
133134
135+ httpClient := & http.Client {}
136+ httpClient .Timeout = c .client .Timeout
137+ if insecure {
138+ customTransport := http .DefaultTransport .(* http.Transport ).Clone ()
139+ customTransport .TLSClientConfig = & tls.Config {InsecureSkipVerify : true }
140+ httpClient .Transport = customTransport
141+ }
142+
134143 return newClient (& ClientOptions {
135144 Host : * rt .IngressHost ,
136145 Auth : AuthOptions {Token : c .token },
137- Client : c . client ,
146+ Client : httpClient ,
138147 graphqlPath : "/app-proxy/api/graphql" ,
139148 }), nil
140149}
0 commit comments