From 019c8d3e18e07e8164dd5c98b782dc1d87254300 Mon Sep 17 00:00:00 2001 From: AlteredCoder Date: Fri, 22 May 2020 17:45:08 +0200 Subject: [PATCH 1/2] fix package config name --- cmd/crowdsec/main.go | 2 +- pkg/{config/crowdsec => csconfig}/config.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) rename pkg/{config/crowdsec => csconfig}/config.go (93%) diff --git a/cmd/crowdsec/main.go b/cmd/crowdsec/main.go index 543bffef5..17e9afce3 100644 --- a/cmd/crowdsec/main.go +++ b/cmd/crowdsec/main.go @@ -10,7 +10,7 @@ import ( "time" "github.com/crowdsecurity/crowdsec/pkg/acquisition" - config "github.com/crowdsecurity/crowdsec/pkg/config/crowdsec" + config "github.com/crowdsecurity/crowdsec/pkg/csconfig" "github.com/crowdsecurity/crowdsec/pkg/cwversion" leaky "github.com/crowdsecurity/crowdsec/pkg/leakybucket" "github.com/crowdsecurity/crowdsec/pkg/outputs" diff --git a/pkg/config/crowdsec/config.go b/pkg/csconfig/config.go similarity index 93% rename from pkg/config/crowdsec/config.go rename to pkg/csconfig/config.go index 3f9c9e2f2..1f6ef3658 100644 --- a/pkg/config/crowdsec/config.go +++ b/pkg/csconfig/config.go @@ -1,4 +1,4 @@ -package config +package csconfig import ( "flag" @@ -15,8 +15,8 @@ import ( "gopkg.in/yaml.v2" ) -// Crowdwatch is the structure of the crowdsec configuration -type Crowdwatch struct { +// CrowdSec is the structure of the crowdsec configuration +type CrowdSec struct { WorkingFolder string `yaml:"working_dir,omitempty"` DataFolder string `yaml:"data_dir,omitempty"` ConfigFolder string `yaml:"config_dir,omitempty"` @@ -40,9 +40,9 @@ type Crowdwatch struct { OutputConfig *outputs.OutputFactory `yaml:"plugin"` } -// NewCrowdwatchConfig create a new crowdsec configuration with default configuration -func NewCrowdwatchConfig() *Crowdwatch { - return &Crowdwatch{ +// NewCrowdSecConfig create a new crowdsec configuration with default configuration +func NewCrowdSecConfig() *CrowdSec { + return &CrowdSec{ LogLevel: log.InfoLevel, Daemonize: false, Profiling: false, @@ -60,7 +60,7 @@ func NewCrowdwatchConfig() *Crowdwatch { } // GetOPT return flags parsed from command line -func (c *Crowdwatch) GetOPT() error { +func (c *CrowdSec) GetOPT() error { AcquisitionFile := flag.String("acquis", "", "path to acquis.yaml") configFile := flag.String("c", "", "configuration file") From ec7aaac9d07c6e40f87851847ab31b9972d83a17 Mon Sep 17 00:00:00 2001 From: AlteredCoder Date: Fri, 22 May 2020 17:46:22 +0200 Subject: [PATCH 2/2] fix --- cmd/crowdsec/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/crowdsec/main.go b/cmd/crowdsec/main.go index 17e9afce3..c1d4b31e6 100644 --- a/cmd/crowdsec/main.go +++ b/cmd/crowdsec/main.go @@ -10,7 +10,7 @@ import ( "time" "github.com/crowdsecurity/crowdsec/pkg/acquisition" - config "github.com/crowdsecurity/crowdsec/pkg/csconfig" + "github.com/crowdsecurity/crowdsec/pkg/csconfig" "github.com/crowdsecurity/crowdsec/pkg/cwversion" leaky "github.com/crowdsecurity/crowdsec/pkg/leakybucket" "github.com/crowdsecurity/crowdsec/pkg/outputs" @@ -33,7 +33,7 @@ var ( holders []leaky.BucketFactory buckets *leaky.Buckets - cConfig *config.Crowdwatch + cConfig *csconfig.CrowdSec /*settings*/ lastProcessedItem time.Time /*keep track of last item timestamp in time-machine. it is used to GC buckets when we dump them.*/ @@ -85,7 +85,7 @@ func main() { inputLineChan := make(chan types.Event) inputEventChan := make(chan types.Event) - cConfig = config.NewCrowdwatchConfig() + cConfig = csconfig.NewCrowdSecConfig() // Handle command line arguments if err := cConfig.GetOPT(); err != nil {