diff --git a/internal/cache/redis.go b/internal/cache/redis.go index 1b78608..fe83eff 100644 --- a/internal/cache/redis.go +++ b/internal/cache/redis.go @@ -13,11 +13,12 @@ type redisCache struct { } // NewRedisCache return a new Cache using redis as backend -func NewRedisCache(URI string, keyPrefix string) (Cache, error) { +func NewRedisCache(URI string, password, keyPrefix string) (Cache, error) { return &redisCache{ client: redis.NewClient(&redis.Options{ - Addr: URI, - DB: 0, + Addr: URI, + Password: password, + DB: 0, }), keyPrefix: keyPrefix, }, nil diff --git a/internal/process/process.go b/internal/process/process.go index 39355f6..0534441 100644 --- a/internal/process/process.go +++ b/internal/process/process.go @@ -44,6 +44,7 @@ const ( eventURIFlag = "event-srv" configAPIURIFlag = "config-api" redisURIFlag = "redis" + redisPassFlag = "redis-pass" torURIFlag = "tor-proxy" userAgentFlag = "user-agent" ) @@ -101,7 +102,7 @@ func (p *defaultProvider) Publisher() (event.Publisher, error) { } func (p *defaultProvider) Cache(keyPrefix string) (cache.Cache, error) { - return cache.NewRedisCache(p.ctx.String(redisURIFlag), keyPrefix) + return cache.NewRedisCache(p.ctx.String(redisURIFlag), p.ctx.String(redisPassFlag), keyPrefix) } func (p *defaultProvider) HTTPClient() (chttp.Client, error) { @@ -287,6 +288,10 @@ func getFeaturesFlags() map[Feature][]cli.Flag { Usage: "URI to the Redis server", Required: true, }, + &cli.StringFlag{ + Name: redisPassFlag, + Usage: "Redis server password", + }, } flags[CrawlingFeature] = []cli.Flag{