mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 12:25:53 +02:00
pkg/cwhub - rename methods for clarity (#2961)
* pkg/cwhub - rename methods for clarity * lint
This commit is contained in:
parent
97e6588a45
commit
0f942a95f1
16 changed files with 67 additions and 59 deletions
|
@ -1,6 +1,7 @@
|
|||
package require
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
|
@ -16,7 +17,7 @@ func LAPI(c *csconfig.Config) error {
|
|||
}
|
||||
|
||||
if c.DisableAPI {
|
||||
return fmt.Errorf("local API is disabled -- this command must be run on the local API machine")
|
||||
return errors.New("local API is disabled -- this command must be run on the local API machine")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -32,7 +33,7 @@ func CAPI(c *csconfig.Config) error {
|
|||
|
||||
func PAPI(c *csconfig.Config) error {
|
||||
if c.API.Server.OnlineClient.Credentials.PapiURL == "" {
|
||||
return fmt.Errorf("no PAPI URL in configuration")
|
||||
return errors.New("no PAPI URL in configuration")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -40,7 +41,7 @@ func PAPI(c *csconfig.Config) error {
|
|||
|
||||
func CAPIRegistered(c *csconfig.Config) error {
|
||||
if c.API.Server.OnlineClient.Credentials == nil {
|
||||
return fmt.Errorf("the Central API (CAPI) must be configured with 'cscli capi register'")
|
||||
return errors.New("the Central API (CAPI) must be configured with 'cscli capi register'")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -56,7 +57,7 @@ func DB(c *csconfig.Config) error {
|
|||
|
||||
func Notifications(c *csconfig.Config) error {
|
||||
if c.ConfigPaths.NotificationDir == "" {
|
||||
return fmt.Errorf("config_paths.notification_dir is not set in crowdsec config")
|
||||
return errors.New("config_paths.notification_dir is not set in crowdsec config")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -82,7 +83,7 @@ func Hub(c *csconfig.Config, remote *cwhub.RemoteHubCfg, logger *logrus.Logger)
|
|||
local := c.Hub
|
||||
|
||||
if local == nil {
|
||||
return nil, fmt.Errorf("you must configure cli before interacting with hub")
|
||||
return nil, errors.New("you must configure cli before interacting with hub")
|
||||
}
|
||||
|
||||
if logger == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue