Log info capi whitelists (#2220)
* add infof command if err was nil * Fix golint * Make message more readable and log individual stats * Missed a d * Remove ' * simplify if/else logic --------- Co-authored-by: Marco Mariani <marco@crowdsec.net>
This commit is contained in:
parent
1f9f81da70
commit
0416a41d58
|
@ -229,7 +229,11 @@ func (c *Config) LoadAPIServer() error {
|
|||
log.Warning("crowdsec local API is disabled from flag")
|
||||
}
|
||||
|
||||
if c.API.Server != nil {
|
||||
if c.API.Server == nil {
|
||||
log.Warning("crowdsec local API is disabled")
|
||||
c.DisableAPI = true
|
||||
return nil
|
||||
}
|
||||
|
||||
//inherit log level from common, then api->server
|
||||
var logLevel log.Level
|
||||
|
@ -261,10 +265,8 @@ func (c *Config) LoadAPIServer() error {
|
|||
return err
|
||||
}
|
||||
|
||||
} else {
|
||||
log.Warning("crowdsec local API is disabled")
|
||||
c.DisableAPI = true
|
||||
return nil
|
||||
if c.API.Server.CapiWhitelistsPath != "" {
|
||||
log.Infof("loaded capi whitelist from %s: %d IPs, %d CIDRs", c.API.Server.CapiWhitelistsPath, len(c.API.Server.CapiWhitelists.Ips), len(c.API.Server.CapiWhitelists.Cidrs))
|
||||
}
|
||||
|
||||
if c.API.Server.Enable == nil {
|
||||
|
@ -361,7 +363,7 @@ func (s *LocalApiServerCfg) LoadCapiWhitelists() error {
|
|||
for _, v := range fromCfg.Cidrs {
|
||||
_, tnet, err := net.ParseCIDR(v)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to parse cidr whitelist '%s' : %v.", v, err)
|
||||
return fmt.Errorf("unable to parse cidr whitelist '%s' : %v", v, err)
|
||||
}
|
||||
s.CapiWhitelists.Cidrs = append(s.CapiWhitelists.Cidrs, tnet)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue