mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
add -error flag to crowdsec binary (#1903)
This commit is contained in:
parent
fa0e590778
commit
fd3e668fe1
10 changed files with 83 additions and 77 deletions
|
@ -9,12 +9,13 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/crowdsecurity/crowdsec/pkg/apiclient"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/types"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/yamlpatch"
|
||||
"github.com/pkg/errors"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/crowdsecurity/crowdsec/pkg/apiclient"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/types"
|
||||
"github.com/crowdsecurity/crowdsec/pkg/yamlpatch"
|
||||
)
|
||||
|
||||
type APICfg struct {
|
||||
|
@ -33,13 +34,13 @@ type ApiCredentialsCfg struct {
|
|||
|
||||
/*global api config (for lapi->oapi)*/
|
||||
type OnlineApiClientCfg struct {
|
||||
CredentialsFilePath string `yaml:"credentials_path,omitempty"` //credz will be edited by software, store in diff file
|
||||
CredentialsFilePath string `yaml:"credentials_path,omitempty"` // credz will be edited by software, store in diff file
|
||||
Credentials *ApiCredentialsCfg `yaml:"-"`
|
||||
}
|
||||
|
||||
/*local api config (for crowdsec/cscli->lapi)*/
|
||||
type LocalApiClientCfg struct {
|
||||
CredentialsFilePath string `yaml:"credentials_path,omitempty"` //credz will be edited by software, store in diff file
|
||||
CredentialsFilePath string `yaml:"credentials_path,omitempty"` // credz will be edited by software, store in diff file
|
||||
Credentials *ApiCredentialsCfg `yaml:"-"`
|
||||
InsecureSkipVerify *bool `yaml:"insecure_skip_verify"` // check if api certificate is bad or not
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ func toValidCIDR(ip string) string {
|
|||
/*local api service configuration*/
|
||||
type LocalApiServerCfg struct {
|
||||
Enable *bool `yaml:"enable"`
|
||||
ListenURI string `yaml:"listen_uri,omitempty"` //127.0.0.1:8080
|
||||
ListenURI string `yaml:"listen_uri,omitempty"` // 127.0.0.1:8080
|
||||
TLS *TLSCfg `yaml:"tls"`
|
||||
DbConfig *DatabaseCfg `yaml:"-"`
|
||||
LogDir string `yaml:"-"`
|
||||
|
@ -171,7 +172,6 @@ type TLSCfg struct {
|
|||
}
|
||||
|
||||
func (c *Config) LoadAPIServer() error {
|
||||
|
||||
if c.DisableAPI {
|
||||
log.Warning("crowdsec local API is disabled from flag")
|
||||
}
|
||||
|
@ -227,9 +227,7 @@ func (c *Config) LoadAPIServer() error {
|
|||
return errors.Wrap(err, "loading online client credentials")
|
||||
}
|
||||
}
|
||||
if c.API.Server.OnlineClient == nil || c.API.Server.OnlineClient.Credentials == nil {
|
||||
log.Printf("push and pull to Central API disabled")
|
||||
}
|
||||
|
||||
if err := c.LoadDBConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue