-
Notifications
You must be signed in to change notification settings - Fork 2
/
conf.go
100 lines (88 loc) · 2.34 KB
/
conf.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main
import (
"fmt"
)
type Config struct {
General GeneralConf `gcfg:"general"`
SourceMqtt SourceMqttConf `gcfg:"source-mqtt"`
PipeTopic PipeTopicConf `gcfg:"pipe-topic"`
ClickHouse ClickHouseConf `gcfg:"clickhouse"`
MonitorMqtt MonitorMqttConf `gcfg:"monitor-mqtt"`
MonitorInfo MonitorInfoConf `gcfg:"monitor-info"`
PipeInfo PipeInfoConf `gcfg:"pipe-info"`
ProcessorInfo ProcessorInfoConf `gcfg:"processor-info"`
AdapterInfo AdapterInfoConf `gcfg:"adapter-info"`
DbStoreInfo DbStoreInfoConf `gcfg:"dbstore-info"`
}
type GeneralConf struct {
Debug bool
Sleepinterval uint
}
type SourceMqttConf struct {
Scheme string
Hostname string
Port uint
Cleansession bool
Qos uint8
Pingtimeout uint8
Keepalive uint16
Username string
Password string
Topicroot string
}
type PipeTopicConf struct {
Targetname string
Topicprefix string
Enablegroupnum bool
Begingroupnum uint16
Endgroupnum uint16
}
type ClickHouseConf struct {
Scheme string
Hostname string
Port uint
Username string
Password string
Database string
Compress bool
Debug bool
}
type MonitorMqttConf struct {
Scheme string
Hostname string
Port uint
Cleansession bool
Qos uint8
Pingtimeout uint8
Keepalive uint16
Username string
Password string
Topicroot string
}
type MonitorInfoConf struct {
Buffersize uint
Publishinterval uint8
}
type PipeInfoConf struct {
Pipeidmaxlen uint8
Taskinterval uint8
Buffersize uint
}
type ProcessorInfoConf struct {
Messageidlength uint8
Buffersize uint
}
type AdapterInfoConf struct {
Adapter string
Rawtablename string
Adaptertablename string
Jsonsample string
Buffersize uint
}
type DbStoreInfoConf struct {
Buffersize uint
}
func (cfg *Config) GetConfInfo() string {
info := fmt.Sprintf("Configuration information ... \n [general] => %+v\n [source-mqtt] => %+v\n [pipe-topic] => %+v\n [clickhouse] => %+v\n [monitor-mqtt] => %+v\n [monitor-info] => %+v\n [pipe-info] => %+v\n [processor-info] => %+v\n [adapter-info] => %+v\n [dbstore-info] => %+v\n ", cfg.General, cfg.SourceMqtt, cfg.PipeTopic, cfg.ClickHouse, cfg.MonitorMqtt, cfg.MonitorInfo, cfg.PipeInfo, cfg.ProcessorInfo, cfg.AdapterInfo, cfg.DbStoreInfo)
return info
}