-
Notifications
You must be signed in to change notification settings - Fork 49
/
args.go
30 lines (26 loc) · 639 Bytes
/
args.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
package main
import (
"os"
"strconv"
)
type args struct {
ServicePollingInterval int
NodePollingInterval int
Retry int
RetryInterval int
}
func getArgs() *args {
return &args{
ServicePollingInterval: getValue(-1, "DF_SERVICE_POLLING_INTERVAL"),
NodePollingInterval: getValue(-1, "DF_NODE_POLLING_INTERVAL"),
Retry: getValue(1, "DF_RETRY"),
RetryInterval: getValue(0, "DF_RETRY_INTERVAL"),
}
}
func getValue(defValue int, varName string) int {
value := defValue
if len(os.Getenv(varName)) > 0 {
value, _ = strconv.Atoi(os.Getenv(varName))
}
return value
}