Skip to content

Commit

Permalink
switch ws url to env variable for zb exchange.
Browse files Browse the repository at this point in the history
  • Loading branch information
jppade committed Apr 29, 2022
1 parent 4a3dbae commit 40b70e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/exchange-scrapers/collector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/diadata-org/diadata/exchange-scrapers/collector
go 1.14

require (
github.com/diadata-org/diadata v1.4.1-rc-140
github.com/diadata-org/diadata v1.4.1-rc-142
github.com/segmentio/kafka-go v0.3.7
github.com/sirupsen/logrus v1.8.1
)
8 changes: 6 additions & 2 deletions pkg/dia/scraper/exchange-scrapers/ZBScraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import (

"github.com/diadata-org/diadata/pkg/dia"
models "github.com/diadata-org/diadata/pkg/model"
"github.com/diadata-org/diadata/pkg/utils"
ws "github.com/gorilla/websocket"
)

var ZBSocketURL string = "wss://api.zb.cafe/websocket"
var ZBSocketURL string = "wss://api.zb.live/websocket"

type ZBSubscribe struct {
Event string `json:"event"`
Expand Down Expand Up @@ -63,8 +64,11 @@ func NewZBScraper(exchange dia.Exchange, scrape bool, relDB *models.RelDB) *ZBSc
chanTrades: make(chan *dia.Trade),
db: relDB,
}

ZBWsURL := utils.Getenv("ZB_WS_URL", ZBSocketURL)

var wsDialer ws.Dialer
SwConn, _, err := wsDialer.Dial(ZBSocketURL, nil)
SwConn, _, err := wsDialer.Dial(ZBWsURL, nil)
if err != nil {
println(err.Error())
}
Expand Down

0 comments on commit 40b70e2

Please sign in to comment.