Added default interval
This commit is contained in:
parent
5c930cd409
commit
f108090967
@ -10,6 +10,13 @@ type AlrmConfig struct {
|
||||
Interval time.Duration
|
||||
}
|
||||
|
||||
func NewConfig() *AlrmConfig {
|
||||
return &AlrmConfig{
|
||||
// Default check interval, 30 seconds
|
||||
Interval: time.Second * 30,
|
||||
}
|
||||
}
|
||||
|
||||
func (ac *AlrmConfig) NewGroup(name string) (*AlrmGroup, error) {
|
||||
if ac.Groups == nil {
|
||||
ac.Groups = make(map[string]*AlrmGroup)
|
||||
|
@ -33,7 +33,7 @@ func (p *Parser) Parse(fn string) (*AlrmConfig, error) {
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
config := &AlrmConfig{}
|
||||
config := NewConfig()
|
||||
|
||||
scan := bufio.NewScanner(file)
|
||||
scan.Split(p.Split)
|
||||
|
Loading…
Reference in New Issue
Block a user