Skip to content

Commit c6feeb6

Browse files
Configure API token using LinodeClient{}.SetToken(...) rather than transport
1 parent 4d6c301 commit c6feeb6

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

driver.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@ import (
55
"encoding/json"
66
"fmt"
77
"net"
8-
"net/http"
98
"os"
109
"path"
1110
"strconv"
1211
"strings"
1312
"sync"
1413
"time"
1514

16-
"golang.org/x/oauth2"
17-
1815
"github.com/docker/go-plugins-helpers/volume"
1916
metadata "github.com/linode/go-metadata"
2017
"github.com/linode/linodego"
@@ -72,16 +69,13 @@ func (driver *linodeVolumeDriver) linodeAPI() (*linodego.Client, error) {
7269
}
7370

7471
func setupLinodeAPI(token string) *linodego.Client {
75-
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
76-
oauth2Client := &http.Client{
77-
Transport: &oauth2.Transport{
78-
Source: tokenSource,
79-
},
80-
}
72+
api := linodego.NewClient(nil)
8173

82-
api := linodego.NewClient(oauth2Client)
8374
ua := fmt.Sprintf("docker-volume-linode/%s linodego/%s", VERSION, linodego.Version)
8475
api.SetUserAgent(ua)
76+
77+
api.SetToken(token)
78+
8579
return &api
8680
}
8781

0 commit comments

Comments
 (0)