Create & Init Project...
This commit is contained in:
26
app/service/ops/log-agent/pkg/flowmonitor/conf.go
Normal file
26
app/service/ops/log-agent/pkg/flowmonitor/conf.go
Normal file
@ -0,0 +1,26 @@
|
||||
package flowmonitor
|
||||
|
||||
import (
|
||||
"time"
|
||||
"errors"
|
||||
|
||||
xtime "go-common/library/time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Interval xtime.Duration
|
||||
Addr string
|
||||
}
|
||||
|
||||
func (fm *FlowMonitor) checkConfig() (err error) {
|
||||
if fm.conf == nil {
|
||||
return errors.New("config for flowmonitor is nil")
|
||||
}
|
||||
if fm.conf.Interval == 0 {
|
||||
fm.conf.Interval = xtime.Duration(time.Second * 5)
|
||||
}
|
||||
if fm.conf.Addr == "" {
|
||||
return errors.New("addr of flowmonitor is nil")
|
||||
}
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user