Skip to content

Commit

Permalink
okex: load broker id from env
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Dec 16, 2024
1 parent 24148a3 commit 49d1188
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/exchange/okex/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package okex

const defaultBrokerId string = "812a557d1116BCDE"
6 changes: 6 additions & 0 deletions pkg/exchange/okex/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package okex
import (
"context"
"fmt"
"os"
"regexp"
"strconv"
"time"
Expand Down Expand Up @@ -92,6 +93,11 @@ func New(key, secret, passphrase string, opts ...Option) *Exchange {
passphrase: passphrase,
client: client,
timeNowFunc: time.Now,
brokerId: defaultBrokerId,
}

if str, ok := os.LookupEnv("OKEX_BROKER_ID"); ok {
ex.brokerId = str
}

for _, o := range opts {
Expand Down

0 comments on commit 49d1188

Please sign in to comment.