support max staging url orverride

This commit is contained in:
c9s 2020-12-17 14:44:30 +08:00
parent 3fa74164fc
commit 1c7d3d5481

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"math"
"os"
"time"
"github.com/google/uuid"
@ -24,7 +25,12 @@ type Exchange struct {
}
func New(key, secret string) *Exchange {
client := maxapi.NewRestClient(maxapi.ProductionAPIURL)
baseURL := maxapi.ProductionAPIURL
if override := os.Getenv("MAX_API_BASE_URL") ; len(override) > 0 {
baseURL = override
}
client := maxapi.NewRestClient(baseURL)
client.Auth(key, secret)
return &Exchange{
client: client,