handle redis password (#87)

*  handle redis password

* 🍱 fix version
This commit is contained in:
maxlerebourg
2023-03-04 11:51:54 +01:00
committed by GitHub
parent b079073ff6
commit 50690d1ac7
8 changed files with 86 additions and 29 deletions
+5 -3
View File
@@ -141,13 +141,12 @@ func New(ctx context.Context, next http.Handler, config *configuration.Config, n
},
cacheClient: &cache.Client{},
}
bouncer.cacheClient.New(config.RedisCacheEnabled, config.RedisCacheHost)
bouncer.cacheClient.New(config.RedisCacheEnabled, config.RedisCacheHost, config.RedisCachePass)
//nolint:nestif
if (config.CrowdsecMode == configuration.StreamMode || config.CrowdsecMode == configuration.AloneMode) && ticker == nil {
if config.CrowdsecMode == configuration.AloneMode {
err = getToken(bouncer)
if err != nil {
if err := getToken(bouncer); err != nil {
logger.Error(fmt.Sprintf("New:getToken %s", err.Error()))
return nil, err
}
@@ -366,6 +365,9 @@ func handleStreamCache(bouncer *Bouncer) error {
logger.Debug("handleStreamCache:alreadyUpdated")
return nil
}
if err.Error() != cache.CacheMiss {
return err
}
bouncer.cacheClient.SetDecision(cacheTimeoutKey, false, bouncer.updateInterval-1)
streamRouteURL := url.URL{
Scheme: bouncer.crowdsecScheme,