diff --git a/config/config.go b/config/config.go index 9e2c506..819ad45 100644 --- a/config/config.go +++ b/config/config.go @@ -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) diff --git a/config/parser.go b/config/parser.go index d7579a7..1dcb14b 100644 --- a/config/parser.go +++ b/config/parser.go @@ -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)