From f55ecc6a7c7866a13fe9f5b84b295f2935c6ff1f Mon Sep 17 00:00:00 2001 From: Marc Ignacio Date: Thu, 22 Jun 2017 09:10:08 +0800 Subject: Allows for other common redis options to be in cable.yml, by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adds RedisAdapterTest::AlternateConfiguration to account for a relatively common alternative setup, as it’s used as the first example in the [Redis rubygem](https://github.com/redis/redis-rb#getting-started) - Supplies original RedisAdapterTest with more complete redis:// url format by adding a ‘userinfo’ (blank user), so that it resembles the alternate configuration - Supplies original EventedRedisAdapterTest with more complete redis:// url as well - Adds before_script to start redis-server with password as a daemon and with explicit defaults copied from the default redis.conf (Instead of using Travis' default init/upstart scripts for `redis` service) --- actioncable/lib/action_cable/subscription_adapter/redis.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actioncable/lib/action_cable') diff --git a/actioncable/lib/action_cable/subscription_adapter/redis.rb b/actioncable/lib/action_cable/subscription_adapter/redis.rb index a31ed33bdb..225609c236 100644 --- a/actioncable/lib/action_cable/subscription_adapter/redis.rb +++ b/actioncable/lib/action_cable/subscription_adapter/redis.rb @@ -10,7 +10,9 @@ module ActionCable # Overwrite this factory method for redis connections if you want to use a different Redis library than Redis. # This is needed, for example, when using Makara proxies for distributed Redis. - cattr_accessor :redis_connector, default: ->(config) { ::Redis.new(url: config[:url]) } + cattr_accessor :redis_connector, default: ->(config) do + ::Redis.new(config.slice(:url, :host, :port, :db, :password)) + end def initialize(*) super -- cgit v1.2.3