Skip to content

Commit

Permalink
fix: avoid panic when not passing AuthSupplier (#9586)
Browse files Browse the repository at this point in the history
  • Loading branch information
wujunwei authored Sep 19, 2022
1 parent e0bd671 commit 72d3599
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/apiclient/apiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@ func NewClientFromOpts(opts Opts) (context.Context, Client, error) {
return nil, nil, fmt.Errorf("cannot use instance ID with Argo Server")
}
if opts.ArgoServerOpts.HTTP1 {
if opts.AuthSupplier == nil {
return nil, nil, fmt.Errorf("AuthSupplier cannot be empty when connecting to Argo Server")
}
return newHTTP1Client(opts.ArgoServerOpts.GetURL(), opts.AuthSupplier(), opts.ArgoServerOpts.InsecureSkipVerify, opts.ArgoServerOpts.Headers)
} else if opts.ArgoServerOpts.URL != "" {
if opts.AuthSupplier == nil {
return nil, nil, fmt.Errorf("AuthSupplier cannot be empty when connecting to Argo Server")
}
return newArgoServerClient(opts.ArgoServerOpts, opts.AuthSupplier())
} else {
if opts.ClientConfigSupplier != nil {
Expand Down

0 comments on commit 72d3599

Please sign in to comment.