Skip to content

Commit

Permalink
Use Rails method to get RabbitMQ config
Browse files Browse the repository at this point in the history
The previous implementation isn't compatible with Ruby 3.1 due to the
upgrade of Psych (YAML library) to 4.0 [1] in stdlib and the change in `load_file`.

A simpler way to replace this is to use the Rails built in method to
load a config file.

[1]: ruby/psych#488
  • Loading branch information
kevindew committed Jul 20, 2022
1 parent 8a3389d commit 78a8088
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tasks/setup_exchange.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
desc "Create RabbitMQ exchanges"
task setup_exchange: :environment do
config = YAML.load_file(Rails.root.join("config/rabbitmq.yml"))[Rails.env].symbolize_keys
config = Rails.application.config_for(:rabbitmq)

bunny = Bunny.new(ENV["RABBITMQ_URL"])
channel = bunny.start.create_channel
Expand Down

0 comments on commit 78a8088

Please sign in to comment.