/
config.go
57 lines (51 loc) · 1.14 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package config
import (
"time"
"github.com/lomik/zapwriter"
)
// MetricEndpointLocal text for local metric endpoint
const MetricEndpointLocal = "local"
// Config for syphon server
type Config struct {
Metric metricConfig `toml:"metric"`
Logging []zapwriter.Config `toml:"logging"`
File fileConfig `toml:"file"`
Prometheus promConfig `toml:"prometheus"`
TCP tcpConfig `toml:"tcp"`
UDP udpConfig `toml:"udp"`
Uploader uploaderConfig `toml:"uploader"`
}
type metricConfig struct {
Endpoint string `toml:"endpoint"`
Interval *Duration `toml:"interval"`
}
func newConfig() *Config {
return &Config{
Metric: metricConfig{
Interval: &Duration{
Duration: time.Minute,
},
Endpoint: MetricEndpointLocal,
},
Logging: nil,
Uploader: uploaderConfig{
File: []fileUploadConfig{{
Enabled: true,
Path: "metrics_recieved.txt",
}},
},
UDP: udpConfig{
Listen: ":2003",
Mode: "normal",
Enabled: true,
},
TCP: tcpConfig{
Listen: ":2003",
Enabled: true,
},
Prometheus: promConfig{
Listen: ":2006",
Enabled: false,
},
}
}