forked from firdasafridi/go-indodax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.go
37 lines (31 loc) · 737 Bytes
/
env.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
package indodax
import (
"os"
)
//
// environment contains default and dynamics values that gathered from external
// resources, for example system environment variables.
//
type environment struct {
BaseHostPublic string
BaseHostPrivate string
apiKey string
apiSecret string
}
func newEnvironment() (env *environment) {
env = &environment{
BaseHostPublic: UrlPublic,
BaseHostPrivate: UrlPrivate,
apiKey: os.Getenv("INDODAX_KEY"),
apiSecret: os.Getenv("INDODAX_SECRET"),
}
pubHost := os.Getenv("INDODAX_PUB_HOST")
if pubHost != "" {
env.BaseHostPublic = pubHost
}
privHost := os.Getenv("INDODAX_PRIV_HOST")
if privHost != "" {
env.BaseHostPrivate = privHost
}
return env
}