mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 19:48:59 +02:00
🍱 fix
This commit is contained in:
+6
-11
@@ -44,11 +44,10 @@ type Config struct {
|
|||||||
ForwardedHeadersCustomName string `json:"forwardedheaderscustomheader,omitempty"`
|
ForwardedHeadersCustomName string `json:"forwardedheaderscustomheader,omitempty"`
|
||||||
UpdateIntervalSeconds int64 `json:"updateIntervalSeconds,omitempty"`
|
UpdateIntervalSeconds int64 `json:"updateIntervalSeconds,omitempty"`
|
||||||
DefaultDecisionSeconds int64 `json:"defaultDecisionSeconds,omitempty"`
|
DefaultDecisionSeconds int64 `json:"defaultDecisionSeconds,omitempty"`
|
||||||
ForwardedHeadersTrustedIPs []string `json:"forwardedheaderstrustedips,omitempty"`
|
ForwardedHeadersTrustedIPs []string `json:"forwardedHeadersTrustedIps,omitempty"`
|
||||||
RedisCacheEnabled bool `json:"rediscacheenabled,omitempty"`
|
RedisCacheEnabled bool `json:"redisCacheEnabled,omitempty"`
|
||||||
RedisCacheAddr string `json:"rediscacheaddr,omitempty"`
|
RedisCacheHost string `json:"redisCacheHost,omitempty"`
|
||||||
RedisCachePort int `json:"rediscacheport,omitempty"`
|
RedisCachePassword string `json:"redisCachePassword,omitempty"`
|
||||||
RedisCachePassword string `json:"rediscachepassword,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateConfig creates the default plugin configuration.
|
// CreateConfig creates the default plugin configuration.
|
||||||
@@ -65,8 +64,7 @@ func CreateConfig() *Config {
|
|||||||
ForwardedHeadersTrustedIPs: []string{},
|
ForwardedHeadersTrustedIPs: []string{},
|
||||||
ForwardedHeadersCustomName: "X-Forwarded-For",
|
ForwardedHeadersCustomName: "X-Forwarded-For",
|
||||||
RedisCacheEnabled: false,
|
RedisCacheEnabled: false,
|
||||||
RedisCacheAddr: "localhost",
|
RedisCacheHost: "redis:6379",
|
||||||
RedisCachePort: 6379,
|
|
||||||
RedisCachePassword: "",
|
RedisCachePassword: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,10 +123,7 @@ func New(ctx context.Context, next http.Handler, config *Config, name string) (h
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
if config.RedisCacheEnabled {
|
if config.RedisCacheEnabled {
|
||||||
cache.InitRedisClient(config.RedisCacheAddr, config.RedisCachePort, config.RedisCachePassword)
|
cache.InitRedisClient(config.RedisCacheHost, config.RedisCachePassword)
|
||||||
c, _ := redis.Dial("tcp", ":6379")
|
|
||||||
|
|
||||||
defer c.Close()
|
|
||||||
}
|
}
|
||||||
if config.CrowdsecMode == streamMode {
|
if config.CrowdsecMode == streamMode {
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user