-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.go
38 lines (32 loc) · 873 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
37
38
package main
const (
rsyncDefaultTimeoutSeconds = 10
)
type config struct {
Syncs []configSync `toml:"sync"`
}
type configSync struct {
Source string `toml:"source"`
Target string `toml:"target"`
Exclude []string `toml:"exclude"`
Rsync configRsync `toml:"rsync"`
}
type configRsync struct {
Rsh string `toml:"rsh"`
ACLs bool `toml:"acls"`
Perms bool `toml:"perms"`
TimeoutSeconds int `toml:"timeout_seconds"`
ConnectTimeoutSeconds int `toml:"connect_timeout_seconds"`
}
func (c configRsync) getTimeoutSeconds() int {
if c.TimeoutSeconds > 0 {
return c.TimeoutSeconds
}
return rsyncDefaultTimeoutSeconds
}
func (c configRsync) getConnectTimeoutSeconds() int {
if c.ConnectTimeoutSeconds > 0 {
return c.ConnectTimeoutSeconds
}
return rsyncDefaultTimeoutSeconds
}