-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
40 lines (34 loc) · 1.12 KB
/
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
39
40
package ftpTreeBuilder
import (
"log"
)
const (
defaultMaxFTPCons = 5
defaultReconnectIterCount = 5
defaultReconnectSleepSeconds = 10
)
// FTPBuilderConfig конфиг для постройки дерева по образу ftp
type FTPBuilderConfig struct {
*log.Logger
MaxFTPCons int `yaml:"max_ftp_connections"`
ServicePort string `yaml:"service_port"`
RootNodeDirectory string `yaml:"root_node_directory"`
FTPAddr string `yaml:"ftp_addr"`
FTPLogin string `yaml:"ftp_login"`
FTPPass string `yaml:"ftp_pass"`
DBConString string `yaml:"db_con_str"`
RedisConString string `yaml:"redis_con_str"`
RedisPassword string `yaml:"redis_password"`
}
// Prepare установка, при необходимости, дефолтных значений
func (cf *FTPBuilderConfig) Prepare() {
if cf.MaxFTPCons == 0 {
cf.MaxFTPCons = defaultMaxFTPCons
}
// if cf.ReconnectIterCount == 0 {
// cf.ReconnectIterCount = defaultReconnectIterCount
// }
// if cf.ReconnectSleepSeconds == 0 {
// cf.ReconnectSleepSeconds = defaultReconnectSleepSeconds
// }
}