Skip to content

Commit

Permalink
Update client.go
Browse files Browse the repository at this point in the history
  • Loading branch information
shaxiaozz authored Dec 15, 2022
1 parent c1584dd commit e2aeed2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apiv2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,20 @@ func NewRESTClientForHost(u, username, password string, opts *config.Options) (*

v2SwaggerClient := v2client.New(runtimeclient.New(harborURL.Host, harborURL.Path, []string{harborURL.Scheme}), strfmt.Default)
authInfo := runtimeclient.BasicAuth(username, password)

return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
if harborURL.Scheme == "https" {
var optsTLS runtimeclient.TLSClientOptions
optsTLS.InsecureSkipVerify = true
client, err := runtimeclient.TLSClient(optsTLS)
if err != nil {
return nil, err
}
v2SwaggerClient = v2client.New(runtimeclient.NewWithClient(harborURL.Host, harborURL.Path, []string{harborURL.Scheme}, client), strfmt.Default)
return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
} else {
v2SwaggerClient = v2client.New(runtimeclient.New(harborURL.Host, harborURL.Path, []string{harborURL.Scheme}), strfmt.Default)
return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
}
//return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
}

// AuditLog Client
Expand Down

0 comments on commit e2aeed2

Please sign in to comment.