Skip to content

Commit f540796

Browse files
authored
Merge pull request #425 from linode/fix-url
[fix] : add default linode URL
2 parents ab55c83 + 1b89f9a commit f540796

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cloud/linode/client/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
const (
2121
// DefaultClientTimeout is the default timeout for a client Linode API call
2222
DefaultClientTimeout = 120 * time.Second
23+
DefaultLinodeAPIURL = "https://api.linode.com"
2324
)
2425

2526
type Client interface {
@@ -72,6 +73,9 @@ var _ Client = (*linodego.Client)(nil)
7273
func New(token string, timeout time.Duration) (*linodego.Client, error) {
7374
userAgent := fmt.Sprintf("linode-cloud-controller-manager %s", linodego.DefaultUserAgent)
7475
apiURL := os.Getenv("LINODE_URL")
76+
if apiURL == "" {
77+
apiURL = DefaultLinodeAPIURL
78+
}
7579

7680
linodeClient := linodego.NewClient(&http.Client{Timeout: timeout})
7781
client, err := linodeClient.UseURL(apiURL)

cloud/linode/cloud_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ func TestNewCloudRouteControllerDisabled(t *testing.T) {
2020
t.Setenv("LINODE_API_TOKEN", "dummyapitoken")
2121
t.Setenv("LINODE_REGION", "us-east")
2222
t.Setenv("LINODE_REQUEST_TIMEOUT_SECONDS", "10")
23-
t.Setenv("LINODE_URL", "https://api.linode.com/v4")
2423
Options.NodeBalancerPrefix = "ccm"
2524

2625
t.Run("should not fail if vpc is empty and routecontroller is disabled", func(t *testing.T) {

0 commit comments

Comments
 (0)