Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
Fix wrong URL for GH enterprise server graphQL endpoint issue (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oded-B authored Jun 6, 2023
1 parent da3efe9 commit af61fd6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/pkg/githubapi/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ func CreateGithubRestClient(githubOauthToken string, githubRestAltURL string, ct
return client
}

func createGithubAppGraphQlClient(githubAppPrivateKeyPath string, githubAppId int64, githubAppInstallationId int64, githubGraphqlAltURL string, githubRestAltURL string, ctx context.Context) *githubv4.Client {
func createGithubAppGraphQlClient(githubAppPrivateKeyPath string, githubAppId int64, githubAppInstallationId int64, githubGraphqlAltURL string, ctx context.Context) *githubv4.Client {
itr, err := ghinstallation.NewKeyFromFile(http.DefaultTransport, githubAppId, githubAppInstallationId, githubAppPrivateKeyPath)
if err != nil {
log.Fatal(err)
}
var client *githubv4.Client

if githubRestAltURL != "" {
itr.BaseURL = githubRestAltURL
client = githubv4.NewEnterpriseClient(githubRestAltURL, &http.Client{Transport: itr})
if githubGraphqlAltURL != "" {
itr.BaseURL = githubGraphqlAltURL
client = githubv4.NewEnterpriseClient(githubGraphqlAltURL, &http.Client{Transport: itr})
} else {
client = githubv4.NewClient(&http.Client{Transport: itr})
}
Expand Down Expand Up @@ -157,7 +157,7 @@ func CreateAllClients(ctx context.Context) (*github.Client, *githubv4.Client, *g
}

mainGithubClient = createGithubAppRestClient(githubAppPrivateKeyPath, githubAppId, githubAppInstallationId, githubRestAltURL, ctx)
githubGraphQlClient = createGithubAppGraphQlClient(githubAppPrivateKeyPath, githubAppId, githubAppInstallationId, githubGraphqlAltURL, githubRestAltURL, ctx)
githubGraphQlClient = createGithubAppGraphQlClient(githubAppPrivateKeyPath, githubAppId, githubAppInstallationId, githubGraphqlAltURL, ctx)
} else {
mainGithubClient = CreateGithubRestClient(getCrucialEnv("GITHUB_OAUTH_TOKEN"), githubRestAltURL, ctx)
githubGraphQlClient = createGithubGraphQlClient(getCrucialEnv("GITHUB_OAUTH_TOKEN"), githubGraphqlAltURL)
Expand Down

0 comments on commit af61fd6

Please sign in to comment.