Class: Tidewave::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/tidewave/railtie.rb

Class Method Summary collapse

Class Method Details

.cable_config(app) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tidewave/railtie.rb', line 14

def self.cable_config(app)
  cable =
    begin
      if app.root.join("config", "cable.yml").exist?
        app.config_for(:cable)&.to_h&.deep_stringify_keys
      end
    rescue StandardError => error
      Rails.logger&.warn("Tidewave could not load config/cable.yml: #{error.message}")
      nil
    end

  # Default to the in-process async adapter, as Rails does in development.
  cable.presence || { "adapter" => "async" }
end