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 {
@@ -72,6 +73,9 @@ var _ Client = (*linodego.Client)(nil)
7273func 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 )
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