File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
20
20
const (
21
21
// DefaultClientTimeout is the default timeout for a client Linode API call
22
22
DefaultClientTimeout = 120 * time .Second
23
+ DefaultLinodeAPIURL = "https://api.linode.com"
23
24
)
24
25
25
26
type Client interface {
@@ -72,6 +73,9 @@ var _ Client = (*linodego.Client)(nil)
72
73
func New (token string , timeout time.Duration ) (* linodego.Client , error ) {
73
74
userAgent := fmt .Sprintf ("linode-cloud-controller-manager %s" , linodego .DefaultUserAgent )
74
75
apiURL := os .Getenv ("LINODE_URL" )
76
+ if apiURL == "" {
77
+ apiURL = DefaultLinodeAPIURL
78
+ }
75
79
76
80
linodeClient := linodego .NewClient (& http.Client {Timeout : timeout })
77
81
client , err := linodeClient .UseURL (apiURL )
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ func TestNewCloudRouteControllerDisabled(t *testing.T) {
20
20
t .Setenv ("LINODE_API_TOKEN" , "dummyapitoken" )
21
21
t .Setenv ("LINODE_REGION" , "us-east" )
22
22
t .Setenv ("LINODE_REQUEST_TIMEOUT_SECONDS" , "10" )
23
- t .Setenv ("LINODE_URL" , "https://api.linode.com/v4" )
24
23
Options .NodeBalancerPrefix = "ccm"
25
24
26
25
t .Run ("should not fail if vpc is empty and routecontroller is disabled" , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments