diff --git a/github-api/client/client.go b/github-api/client/client.go index c235855..750a43b 100644 --- a/github-api/client/client.go +++ b/github-api/client/client.go @@ -2,7 +2,6 @@ package client import ( "context" - "log" "github.com/google/go-github/github" "golang.org/x/oauth2" @@ -10,17 +9,17 @@ import ( // clientConnect Takens a token and uses this to establish a connection to github func ClientConnect(token string) *github.Client { - + var client *github.Client // get env token // Connect to giithub - if token == "" { - log.Fatal("token missing") - } ctx := context.Background() ts := oauth2.StaticTokenSource( &oauth2.Token{AccessToken: token}, ) tc := oauth2.NewClient(ctx, ts) - client := github.NewClient(tc) + client = github.NewClient(tc) + if token == "" { + client = github.NewClient(nil) + } return client }