Skip to content

Commit

Permalink
🐛 clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlerebourg committed Aug 18, 2023
1 parent f4ef69c commit c11a083
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
9 changes: 0 additions & 9 deletions bouncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ type Bouncer struct {
crowdsecScenarios []string
updateInterval int64
defaultDecisionTimeout int64
CrowdsecStreamTimeout int64
customHeader string
crowdsecStreamRoute string
crowdsecHeader string
Expand All @@ -84,14 +83,6 @@ func New(ctx context.Context, next http.Handler, config *configuration.Config, n
var tlsConfig *tls.Config
crowdsecStreamRoute := ""
crowdsecHeader := ""
// here we have GetVariable which returns a string
crowdsecStreamTimeoutStr, _ := configuration.GetVariable(config, "CrowdsecStreamTimeout")
// I would had a test that the value can be converted to int
_, err = fmt.Sscan(crowdsecStreamTimeoutStr, &config.CrowdsecStreamTimeout)
if err != nil {
logger.Error(fmt.Sprintf("New:sscan: %s", err.Error()))
return nil, err
}
if config.CrowdsecMode == configuration.AloneMode {
config.CrowdsecCapiMachineID, _ = configuration.GetVariable(config, "CrowdsecCapiMachineID")
config.CrowdsecCapiPassword, _ = configuration.GetVariable(config, "CrowdsecCapiPassword")
Expand Down
2 changes: 0 additions & 2 deletions pkg/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type Config struct {
CrowdsecCapiPassword string `json:"crowdsecCapiPassword,omitempty"`
CrowdsecCapiPasswordFile string `json:"crowdsecCapiPasswordFile,omitempty"`
CrowdsecCapiScenarios []string `json:"crowdsecCapiScenarios,omitempty"`
CrowdsecStreamTimeout int64 `json:"crowdsecStreamTimeout,omitempty"`
UpdateIntervalSeconds int64 `json:"updateIntervalSeconds,omitempty"`
DefaultDecisionSeconds int64 `json:"defaultDecisionSeconds,omitempty"`
DefaultTimeoutSeconds int64 `json:"defaultTimeoutSeconds,omitempty"`
Expand Down Expand Up @@ -81,7 +80,6 @@ func New() *Config {
CrowdsecLapiHost: "crowdsec:8080",
CrowdsecLapiKey: "",
CrowdsecLapiTLSInsecureVerify: false,
CrowdsecStreamTimeout: 10,
UpdateIntervalSeconds: 60,
DefaultDecisionSeconds: 60,
DefaultTimeoutSeconds: 10,
Expand Down

0 comments on commit c11a083

Please sign in to comment.