Skip to content

Commit

Permalink
Fix init
Browse files Browse the repository at this point in the history
  • Loading branch information
nezorflame committed Jul 11, 2021
1 parent f59b3e3 commit efe478f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import (
"time"

"github.com/google/go-github/v37/github"
"github.com/opengapps/package-api/pkg/gapps"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"golang.org/x/oauth2"
"golang.org/x/sync/errgroup"

"github.com/opengapps/package-api/pkg/gapps"

"github.com/opengapps/package-api/internal/pkg/config"
"github.com/opengapps/package-api/internal/pkg/db"
"github.com/opengapps/package-api/internal/pkg/models"
Expand Down Expand Up @@ -43,14 +44,14 @@ func NewClient(ctx context.Context, opts ...Option) (*client, error) {
if c.storage == nil {
return nil, errors.New("storage is nil")
}
if c.client == nil {
return nil, errors.New("client for Github is nil")
}

ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: c.cfg.GetString(config.GithubTokenKey)},
)
c.client = github.NewClient(oauth2.NewClient(ctx, ts))
if c.client == nil {
return nil, errors.New("client for Github is nil")
}

return c, nil
}
Expand Down

0 comments on commit efe478f

Please sign in to comment.