aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2015-12-16 15:42:35 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2015-12-16 15:42:35 +0100
commit6bfd191c0f8005fcb4c140f77567e17c189ba238 (patch)
treefdb29ee42628c6221722bcc919c18d72a72fa9e9 /actioncable
parent3784068475c0109bfec0a9eb5877c4ae2e8b5a72 (diff)
downloadrails-6bfd191c0f8005fcb4c140f77567e17c189ba238.tar.gz
rails-6bfd191c0f8005fcb4c140f77567e17c189ba238.tar.bz2
rails-6bfd191c0f8005fcb4c140f77567e17c189ba238.zip
Only initialize redis if the config file is there
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/lib/action_cable/railtie.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/actioncable/lib/action_cable/railtie.rb b/actioncable/lib/action_cable/railtie.rb
index 1faecb19d7..7135b75d69 100644
--- a/actioncable/lib/action_cable/railtie.rb
+++ b/actioncable/lib/action_cable/railtie.rb
@@ -19,15 +19,15 @@ module ActionCable
end
initializer "action_cable.set_configs" do |app|
- app.paths.add "config/redis/cable", with: "config/redis/cable.yml"
-
options = app.config.action_cable
-
options.allowed_request_origins ||= "http://localhost:3000" if ::Rails.env.development?
+ app.paths.add "config/redis/cable", with: "config/redis/cable.yml"
+
ActiveSupport.on_load(:action_cable) do
- path = Pathname.new(paths["config/redis/cable"].existent.first)
- self.redis = Rails.application.config_for(redis_path).with_indifferent_access
+ if redis_cable_path = app.config.paths["config/redis/cable"].existent
+ self.redis = Rails.application.config_for(Pathname.new(redis_cable_path.first)).with_indifferent_access
+ end
options.each { |k,v| send("#{k}=", v) }
end