Provisioning: fix authorized github client initialization (#108290)

* Add logging

* Fix the condition for the github token

* Revert "Add logging"

This reverts commit 71cbc675f6.

* Fix condition
eleijonmarck/memcached-client/updatedintervalandconnectionchecks
Roberto Jiménez Sánchez 3 days ago committed by GitHub
parent ca1ecf0764
commit 5cf48294f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      pkg/registry/apis/provisioning/repository/github/factory.go

@ -12,6 +12,7 @@ import (
// It exists only for the ability to test the code easily. // It exists only for the ability to test the code easily.
type Factory struct { type Factory struct {
// Client allows overriding the client to use in the GH client returned. It exists primarily for testing. // Client allows overriding the client to use in the GH client returned. It exists primarily for testing.
// FIXME: we should replace in this way. We should add some options pattern for the factory.
Client *http.Client Client *http.Client
} }
@ -28,7 +29,7 @@ func (r *Factory) New(ctx context.Context, ghToken string) Client {
&oauth2.Token{AccessToken: ghToken}, &oauth2.Token{AccessToken: ghToken},
) )
if len(ghToken) == 0 { if len(ghToken) > 0 {
tokenClient := oauth2.NewClient(ctx, tokenSrc) tokenClient := oauth2.NewClient(ctx, tokenSrc)
return NewClient(github.NewClient(tokenClient)) return NewClient(github.NewClient(tokenClient))
} }

Loading…
Cancel
Save