Skip to content

Commit

Permalink
Merge pull request #2 from coinbase-samples/jc-development
Browse files Browse the repository at this point in the history
add env var support for baseUrl
  • Loading branch information
jc-cb authored Feb 22, 2024
2 parents 5dc5b4b + d916af7 commit 7dc342f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package intx

import (
"net/http"
"os"
)

var defaultV1ApiBaseUrl = "https://api.international.coinbase.com/api/v1"
Expand All @@ -34,9 +35,14 @@ func (c *Client) BaseUrl(u string) *Client {
}

func NewClient(credentials *Credentials, httpClient http.Client) *Client {
baseUrl := os.Getenv("INTX_BASE_URL")
if baseUrl == "" {
baseUrl = defaultV1ApiBaseUrl
}

return &Client{
Credentials: credentials,
HttpClient: httpClient,
HttpBaseUrl: defaultV1ApiBaseUrl,
HttpBaseUrl: baseUrl,
}
}

0 comments on commit 7dc342f

Please sign in to comment.