diff --git a/config.go b/config.go index 7de4407ec..7b42d588a 100644 --- a/config.go +++ b/config.go @@ -63,6 +63,8 @@ type RedisCacheConfig struct { Protocol string `toml:"protocol"` // Endpoint represents FQDN:port or IPAddress:Port of the Redis server Endpoint string `toml:"endpoint"` + // Password can be set when using password protected redis instance. + Password string `toml:"password"` } // BoltDBCacheConfig is a collection of Configurations for storing cached data on the Filesystem diff --git a/redis.go b/redis.go index f20e29db3..857c98d8f 100644 --- a/redis.go +++ b/redis.go @@ -36,6 +36,9 @@ func (r *RedisCache) Connect() error { Network: r.Config.Protocol, Addr: r.Config.Endpoint, }) + if r.Config.Password != "" { + r.client.Options().Password = r.Config.Password + } return r.client.Ping().Err() }