Skip to content

Commit

Permalink
Only initialize redis if the config file is there
Browse files Browse the repository at this point in the history
  • Loading branch information
dhh committed Dec 16, 2015
1 parent 3784068 commit 6bfd191
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions actioncable/lib/action_cable/railtie.rb
Expand Up @@ -19,15 +19,15 @@ class Railtie < Rails::Railtie # :nodoc:
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
Expand Down

0 comments on commit 6bfd191

Please sign in to comment.