Skip to content

Commit

Permalink
cscli: type configGetter
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Jan 31, 2024
1 parent a9f433b commit 42bcfc6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions cmd/crowdsec-cli/bouncers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/require"
middlewares "github.com/crowdsecurity/crowdsec/pkg/apiserver/middlewares/v1"
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
"github.com/crowdsecurity/crowdsec/pkg/database"
"github.com/crowdsecurity/crowdsec/pkg/types"
)
Expand All @@ -38,10 +37,10 @@ func askYesNo(message string, defaultAnswer bool) (bool, error) {

type cliBouncers struct {
db *database.Client
cfg func() *csconfig.Config
cfg configGetter
}

func NewCLIBouncers(getconfig func() *csconfig.Config) *cliBouncers {
func NewCLIBouncers(getconfig configGetter) *cliBouncers {
return &cliBouncers{
cfg: getconfig,
}
Expand Down
5 changes: 2 additions & 3 deletions cmd/crowdsec-cli/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import (
"gopkg.in/yaml.v3"

"github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/require"
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
"github.com/crowdsecurity/crowdsec/pkg/cwhub"
)

type cliHub struct{
cfg func() *csconfig.Config
cfg configGetter
}

func NewCLIHub(getconfig func() *csconfig.Config) *cliHub {
func NewCLIHub(getconfig configGetter) *cliHub {
return &cliHub{
cfg: getconfig,
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/crowdsec-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ var mergedConfig string
// flagBranch overrides the value in csConfig.Cscli.HubBranch
var flagBranch = ""

type configGetter func() *csconfig.Config

func initConfig() {
var err error

Expand Down

0 comments on commit 42bcfc6

Please sign in to comment.