Skip to content

Commit cef964c

Browse files
author
Rahul Sharma
committed
add default linode URL
1 parent b0bf52f commit cef964c

File tree

1 file changed

+4
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)