-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
36 lines (32 loc) · 863 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
36
package mongoout
import "time"
type config struct {
Index string `config:"index"`
LoadBalance bool `config:"loadbalance"`
MaxRetries int `config:"max_retries"`
Timeout time.Duration `config:"timeout"`
Hosts []string `config:"urls"`
DB string `config:"db"`
Collection string `config:"collection"`
bulkMaxSize int `config:"bulk_max_size"`
Backoff backoff `config:"backoff"`
}
type backoff struct {
Init time.Duration
Max time.Duration
}
func defaultConfig() config {
return config{
Hosts: []string{"mongodb://localhost:27017"},
Timeout: 5 * time.Second,
LoadBalance: true,
DB: "test",
Collection: "test",
bulkMaxSize: 100,
MaxRetries: 3,
Backoff: backoff{
Init: 1 * time.Second,
Max: 60 * time.Second,
},
}
}