From 42bcfc6ccf2633370ace769da6b47083d4508219 Mon Sep 17 00:00:00 2001 From: marco Date: Wed, 31 Jan 2024 17:00:14 +0100 Subject: [PATCH] cscli: type configGetter --- cmd/crowdsec-cli/bouncers.go | 5 ++--- cmd/crowdsec-cli/hub.go | 5 ++--- cmd/crowdsec-cli/main.go | 2 ++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/crowdsec-cli/bouncers.go b/cmd/crowdsec-cli/bouncers.go index 410827b3159..d2685901ebb 100644 --- a/cmd/crowdsec-cli/bouncers.go +++ b/cmd/crowdsec-cli/bouncers.go @@ -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" ) @@ -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, } diff --git a/cmd/crowdsec-cli/hub.go b/cmd/crowdsec-cli/hub.go index 929bff501ca..d3ce380bb6f 100644 --- a/cmd/crowdsec-cli/hub.go +++ b/cmd/crowdsec-cli/hub.go @@ -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, } diff --git a/cmd/crowdsec-cli/main.go b/cmd/crowdsec-cli/main.go index b65cfbfebc6..654da1e8ecc 100644 --- a/cmd/crowdsec-cli/main.go +++ b/cmd/crowdsec-cli/main.go @@ -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