From 23620207f7e1a995f0b5dea79c1f613356c991d9 Mon Sep 17 00:00:00 2001 From: Max Lerebourg Date: Sun, 6 Nov 2022 12:57:32 +0100 Subject: [PATCH] :bento: fix before version --- README.md | 2 +- bouncer.go | 6 ++---- docker-compose.yml | 4 ++-- pkg/cache/cache.go | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ebea166..832fed3 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/bouncer.go b/bouncer.go index e32ad47..0b7ea6b 100644 --- a/bouncer.go +++ b/bouncer.go @@ -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() { diff --git a/docker-compose.yml b/docker-compose.yml index 6f0b2f7..bc7f0a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/pkg/cache/cache.go b/pkg/cache/cache.go index ea1ccd4..1dd9346 100644 --- a/pkg/cache/cache.go +++ b/pkg/cache/cache.go @@ -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")