Skip to content

Commit

Permalink
✨ fix ugly code
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlerebourg committed Aug 18, 2023
1 parent 64a183e commit f4ef69c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bouncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func New(ctx context.Context, next http.Handler, config *configuration.Config, n
IdleConnTimeout: 30 * time.Second,
TLSClientConfig: tlsConfig,
},
Timeout: 10 * time.Second,
Timeout: config.defaultTimeoutSeconds * time.Second,

Check failure on line 149 in bouncer.go

View workflow job for this annotation

GitHub Actions / Go (1.x, ubuntu-latest)

config.defaultTimeoutSeconds undefined (type *configuration.Config has no field or method defaultTimeoutSeconds, but does have DefaultTimeoutSeconds)

Check failure on line 149 in bouncer.go

View workflow job for this annotation

GitHub Actions / Go (1.x, ubuntu-latest)

config.defaultTimeoutSeconds undefined (type *configuration.Config has no field or method defaultTimeoutSeconds, but does have DefaultTimeoutSeconds)
},
cacheClient: &cache.Client{},
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type Config struct {
CrowdsecStreamTimeout int64 `json:"crowdsecStreamTimeout,omitempty"`
UpdateIntervalSeconds int64 `json:"updateIntervalSeconds,omitempty"`
DefaultDecisionSeconds int64 `json:"defaultDecisionSeconds,omitempty"`
DefaultTimeoutSeconds int64 `json:"defaultTimeoutSeconds,omitempty"`
ForwardedHeadersCustomName string `json:"forwardedheaderscustomheader,omitempty"`
ForwardedHeadersTrustedIPs []string `json:"forwardedHeadersTrustedIps,omitempty"`
ClientTrustedIPs []string `json:"clientTrustedIps,omitempty"`
Expand Down Expand Up @@ -83,6 +84,7 @@ func New() *Config {
CrowdsecStreamTimeout: 10,
UpdateIntervalSeconds: 60,
DefaultDecisionSeconds: 60,
DefaultTimeoutSeconds: 10,
ForwardedHeadersCustomName: "X-Forwarded-For",
ForwardedHeadersTrustedIPs: []string{},
ClientTrustedIPs: []string{},
Expand Down Expand Up @@ -243,6 +245,7 @@ func validateParamsRequired(config *Config) error {
requiredInt := map[string]int64{
"UpdateIntervalSeconds": config.UpdateIntervalSeconds,
"DefaultDecisionSeconds": config.DefaultDecisionSeconds,
"DefaultTimeoutSeconds": config.DefaultTimeoutSeconds,
}
for key, val := range requiredInt {
if val < 1 {
Expand Down

0 comments on commit f4ef69c

Please sign in to comment.