mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
Add explicit configuration for signals sharing and blocklists pull (#3277)
This commit is contained in:
parent
94a2a586e4
commit
5d414f58e5
8 changed files with 165 additions and 24 deletions
|
@ -38,10 +38,17 @@ type ApiCredentialsCfg struct {
|
|||
CertPath string `yaml:"cert_path,omitempty"`
|
||||
}
|
||||
|
||||
/*global api config (for lapi->oapi)*/
|
||||
type CapiPullConfig struct {
|
||||
Community *bool `yaml:"community,omitempty"`
|
||||
Blocklists *bool `yaml:"blocklists,omitempty"`
|
||||
}
|
||||
|
||||
/*global api config (for lapi->capi)*/
|
||||
type OnlineApiClientCfg struct {
|
||||
CredentialsFilePath string `yaml:"credentials_path,omitempty"` // credz will be edited by software, store in diff file
|
||||
Credentials *ApiCredentialsCfg `yaml:"-"`
|
||||
PullConfig CapiPullConfig `yaml:"pull,omitempty"`
|
||||
Sharing *bool `yaml:"sharing,omitempty"`
|
||||
}
|
||||
|
||||
/*local api config (for crowdsec/cscli->lapi)*/
|
||||
|
@ -344,6 +351,21 @@ func (c *Config) LoadAPIServer(inCli bool) error {
|
|||
log.Printf("push and pull to Central API disabled")
|
||||
}
|
||||
|
||||
//Set default values for CAPI push/pull
|
||||
if c.API.Server.OnlineClient != nil {
|
||||
if c.API.Server.OnlineClient.PullConfig.Community == nil {
|
||||
c.API.Server.OnlineClient.PullConfig.Community = ptr.Of(true)
|
||||
}
|
||||
|
||||
if c.API.Server.OnlineClient.PullConfig.Blocklists == nil {
|
||||
c.API.Server.OnlineClient.PullConfig.Blocklists = ptr.Of(true)
|
||||
}
|
||||
|
||||
if c.API.Server.OnlineClient.Sharing == nil {
|
||||
c.API.Server.OnlineClient.Sharing = ptr.Of(true)
|
||||
}
|
||||
}
|
||||
|
||||
if err := c.LoadDBConfig(inCli); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue