mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
Check cscli preconditions with crowdsec-cli/require package (#2388)
This commit is contained in:
parent
a01ce18b98
commit
5cb7013575
21 changed files with 260 additions and 105 deletions
|
@ -234,6 +234,21 @@ func (c *Config) LoadAPIServer() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if c.API.Server.Enable == nil {
|
||||
// if the option is not present, it is enabled by default
|
||||
c.API.Server.Enable = ptr.Of(true)
|
||||
}
|
||||
|
||||
if !*c.API.Server.Enable {
|
||||
log.Warning("crowdsec local API is disabled because 'enable' is set to false")
|
||||
c.DisableAPI = true
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.DisableAPI {
|
||||
return nil
|
||||
}
|
||||
|
||||
//inherit log level from common, then api->server
|
||||
var logLevel log.Level
|
||||
if c.API.Server.LogLevel != nil {
|
||||
|
@ -268,21 +283,6 @@ func (c *Config) LoadAPIServer() error {
|
|||
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 {
|
||||
// if the option is not present, it is enabled by default
|
||||
c.API.Server.Enable = ptr.Of(true)
|
||||
}
|
||||
|
||||
if !*c.API.Server.Enable {
|
||||
log.Warning("crowdsec local API is disabled because 'enable' is set to false")
|
||||
c.DisableAPI = true
|
||||
return nil
|
||||
}
|
||||
|
||||
if c.DisableAPI {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := c.LoadCommon(); err != nil {
|
||||
return fmt.Errorf("loading common configuration: %s", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue