-
Notifications
You must be signed in to change notification settings - Fork 13
/
endpoint.go
45 lines (34 loc) · 893 Bytes
/
endpoint.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package mixin
import (
"os"
"strings"
)
const (
DefaultApiHost = "https://api.mixin.one"
DefaultBlazeHost = "blaze.mixin.one"
ZeromeshApiHost = "https://mixin-api.zeromesh.net"
ZeromeshBlazeHost = "mixin-blaze.zeromesh.net"
EchoApiHost = "https://echo.yiplee.com"
)
func UseApiHost(host string) {
httpClient.HostURL = host
}
var blazeHost = DefaultBlazeHost
func UseBlazeHost(host string) {
blazeHost = host
}
func init() {
if _, ok := os.LookupEnv("MIXIN_SDK_USE_ZEROMESH"); ok {
UseApiHost(ZeromeshApiHost)
UseBlazeHost(ZeromeshBlazeHost)
}
if host, ok := os.LookupEnv("MIXIN_SDK_API_HOST"); ok && host != "" {
UseApiHost(host)
}
if host, ok := os.LookupEnv("MIXIN_SDK_BLAZE_HOST"); ok && host != "" {
UseBlazeHost(host)
}
if hosts, ok := os.LookupEnv("MIXIN_SDK_MIXINNET_HOSTS"); ok && hosts != "" {
UseMixinNetHosts(strings.Split(hosts, ","))
}
}