Skip to content

Commit

Permalink
update client auth
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Sep 26, 2023
1 parent 77a8a41 commit ee94dea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package console
import (
"context"
"fmt"
consoleclient "github.com/pluralsh/console-client-go"
"net/http"

consoleclient "github.com/pluralsh/console-client-go"
)

type consoleClient struct {
Expand All @@ -18,11 +19,10 @@ type ConsoleClient interface {
}

func NewConsoleClient(token, url string) (ConsoleClient, error) {
authHeader := func(req *http.Request) {
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
}
return &consoleClient{
pluralClient: consoleclient.NewClient(http.DefaultClient, fmt.Sprintf("%s/gql", url), authHeader),
ctx: context.Background(),
pluralClient: consoleclient.NewClient(http.DefaultClient, fmt.Sprintf("%s/gql", url), func(req *http.Request) {
req.Header.Set("Authorization", fmt.Sprintf("Token %s", token))
}),
ctx: context.Background(),
}, nil
}

0 comments on commit ee94dea

Please sign in to comment.