Skip to content

Commit

Permalink
🥅 catch error from sscan
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuHa committed Aug 18, 2023
1 parent fd1afe4 commit 64a183e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bouncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ func New(ctx context.Context, next http.Handler, config *configuration.Config, n
// 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
fmt.Sscan(crowdsecStreamTimeoutStr, &config.CrowdsecStreamTimeout)
_, 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

0 comments on commit 64a183e

Please sign in to comment.