Skip to content

Commit

Permalink
Rewrite development section if its set to use redis
Browse files Browse the repository at this point in the history
  • Loading branch information
npezza93 committed Sep 10, 2024
1 parent d1350b4 commit 4b7407d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/generators/solid_cable/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ def configure_production_cable
new_production_cable_config)
end

def configure_development_cable
gsub_file("config/cable.yml",
/development:\n\s*adapter: redis\n url: .*\n/,
new_development_cable_config)
end

private

def new_production_cable_config
Expand All @@ -22,8 +28,23 @@ def new_production_cable_config
connects_to:
database:
writing: cable
reading: cable
polling_interval: 0.1.seconds
keep_messages_around_for: 1.day
YAML
end

def new_development_cable_config
<<~YAML
development:
adapter: solid_cable
connects_to:
database:
writing: cable
reading: cable
polling_interval: 1.second
keep_messages_around_for: 1.day
silence_polling: true
YAML
end
end

0 comments on commit 4b7407d

Please sign in to comment.