-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfig.go
35 lines (31 loc) · 867 Bytes
/
config.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
package ticker
import "os"
type Config struct {
OutPath string
AWSS3Region string
AWSS3Bucket string
BTCAVGPubkey string
BTCAVGPrivkey string
CMCAPIKey string
CMCEnv string
BugsnagAPIKey string
}
func NewConfig() Config {
return Config{
OutPath: getEnvString("TICKER_OUT_PATH", "./"),
AWSS3Region: getEnvString("AWS_S3_REGION", ""),
AWSS3Bucket: getEnvString("AWS_S3_BUCKET", ""),
BTCAVGPubkey: getEnvString("TICKER_BTCAVG_PUBKEY", ""),
BTCAVGPrivkey: getEnvString("TICKER_BTCAVG_PRIVKEY", ""),
CMCAPIKey: getEnvString("TICKER_CMC_API_KEY", ""),
CMCEnv: getEnvString("TICKER_CMC_ENV", "sandbox"),
BugsnagAPIKey: getEnvString("TICKER_BUGSNAG_API_KEY", ""),
}
}
func getEnvString(key string, defaultVal string) string {
val := os.Getenv(key)
if val == "" {
val = defaultVal
}
return val
}