max: load websocket base url from the env var

This commit is contained in:
c9s 2021-03-22 15:47:05 +08:00
parent 088b22f338
commit 24c4d05e91

View File

@ -2,6 +2,7 @@ package max
import ( import (
"context" "context"
"os"
"strconv" "strconv"
"time" "time"
@ -25,8 +26,12 @@ type Stream struct {
} }
func NewStream(key, secret string) *Stream { func NewStream(key, secret string) *Stream {
wss := max.NewWebSocketService(max.WebSocketURL, key, secret) url := os.Getenv("MAX_API_WS_URL")
if url == "" {
url = max.WebSocketURL
}
wss := max.NewWebSocketService(url, key, secret)
stream := &Stream{ stream := &Stream{
websocketService: wss, websocketService: wss,
} }