forked from CrowdStrike/gotel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
39 lines (34 loc) · 789 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
39
package gotel
import (
"code.google.com/p/gcfg"
)
var l *logging
type config struct {
Main struct {
GotelOwnerEmail string
HoursBetweenAlerts int64
DaysToStoreLogs int
}
Smtp struct {
Enabled bool
Fromaddress string
ReplyTO string
}
Pagerduty struct {
Enabled bool
Servicekey string
}
}
// NewConfig returns a gotel config with configPath and sysLogEnabled set.
// As part of initialization it will also parse the provided config file.
func NewConfig(confPath string, sysLogEnabled bool) config {
conf := config{}
l = &logging{EnableSYSLOG: sysLogEnabled}
l.setLogOutput()
err := gcfg.ReadFileInto(&conf, confPath)
if err != nil {
l.err("Conf error %q", err)
panic("Unable to initialize configuration file properly")
}
return conf
}