🍱 fix before version

This commit is contained in:
Max Lerebourg
2022-11-06 12:57:32 +01:00
parent 4a674da9f9
commit 23620207f7
4 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ At each start of synchronisation, the middleware will wait a random number of se
- Enabled
- bool
- enable the plugin
- default: true
- default: false
- LogLevel
- string
- default: `INFO`, expected value are: `INFO`, `DEBUG`
+2 -4
View File
@@ -46,7 +46,6 @@ type Config struct {
ForwardedHeadersTrustedIPs []string `json:"forwardedHeadersTrustedIps,omitempty"`
RedisCacheEnabled bool `json:"redisCacheEnabled,omitempty"`
RedisCacheHost string `json:"redisCacheHost,omitempty"`
RedisCachePassword string `json:"redisCachePassword,omitempty"`
}
// CreateConfig creates the default plugin configuration.
@@ -54,7 +53,7 @@ func CreateConfig() *Config {
return &Config{
Enabled: false,
LogLevel: "INFO",
CrowdsecMode: streamMode,
CrowdsecMode: liveMode,
CrowdsecLapiScheme: "http",
CrowdsecLapiHost: "crowdsec:8080",
CrowdsecLapiKey: "",
@@ -64,7 +63,6 @@ func CreateConfig() *Config {
ForwardedHeadersCustomName: "X-Forwarded-For",
RedisCacheEnabled: false,
RedisCacheHost: "redis:6379",
RedisCachePassword: "",
}
}
@@ -122,7 +120,7 @@ func New(ctx context.Context, next http.Handler, config *Config, name string) (h
},
}
if config.RedisCacheEnabled {
cache.InitRedisClient(config.RedisCacheHost, config.RedisCachePassword)
cache.InitRedisClient(config.RedisCacheHost)
}
if config.CrowdsecMode == streamMode && ticker == nil {
ticker = startTicker(config, func() {
+2 -2
View File
@@ -29,7 +29,7 @@ services:
labels:
- "traefik.enable=true"
# Definition of the router
- "traefik.http.routers.router1.rule=Host(`localhost`) && Path(`/foo`)"
- "traefik.http.routers.router1.rule=Path(`/foo`)"
- "traefik.http.routers.router1.entrypoints=web"
- "traefik.http.routers.router1.middlewares=crowdsec2@docker"
# Definition of the service
@@ -47,7 +47,7 @@ services:
labels:
- "traefik.enable=true"
# Definition of the router
- "traefik.http.routers.router2.rule=Host(`localhost`) && Path(`/bar`)"
- "traefik.http.routers.router2.rule=Path(`/bar`)"
- "traefik.http.routers.router2.entrypoints=web"
- "traefik.http.routers.router2.middlewares=crowdsec2@docker"
# Definition of the service
+1 -1
View File
@@ -86,7 +86,7 @@ func SetDecision(clientIP string, isBanned bool, duration int64) {
}
}
func InitRedisClient(host string, password string) {
func InitRedisClient(host string) {
redisEnabled = true
redis.Init(host)
logger.Debug("connect to redis")