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 (
2020const (
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
2526type Client interface {
@@ -71,6 +72,9 @@ var _ Client = (*linodego.Client)(nil)
7172func New (token string , timeout time.Duration ) (* linodego.Client , error ) {
7273 userAgent := fmt .Sprintf ("linode-cloud-controller-manager %s" , linodego .DefaultUserAgent )
7374 apiURL := os .Getenv ("LINODE_URL" )
75+ if apiURL == "" {
76+ apiURL = DefaultLinodeAPIURL
77+ }
7478
7579 linodeClient := linodego .NewClient (& http.Client {Timeout : timeout })
7680 client , err := linodeClient .UseURL (apiURL )
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments