Skip to content

Instantly share code, notes, and snippets.

@LyricL-Gitster
Created April 30, 2021 19:03
Show Gist options
  • Save LyricL-Gitster/487b31193f8dd23d07bddcbe042a542c to your computer and use it in GitHub Desktop.
Save LyricL-Gitster/487b31193f8dd23d07bddcbe042a542c to your computer and use it in GitHub Desktop.
configure Shoryuken with potentially mocked SQS
# initialize moto SQS queue for dev environment
if Rails.env.development?
sqs = Aws::SQS::Client.new(
access_key_id: ENV["AWS_ACCESS_KEY_ID"],
region: ENV["AWS_REGION"],
endpoint: "http://localhost:4576/",
secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
verify_checksums: false
)
begin
ENV["PARSED_QUEUE_NAME"] = sqs.create_queue(queue_name: ENV['SQS_QUEUE_NAME']).queue_url
rescue Seahorse::Client::NetworkingError => e
puts "Unable to connect to SQS to create dev queue"
end
end
# Rely on ENV["PARSED_QUEUE_NAME"] throughout rest of application
ENV["PARSED_QUEUE_NAME"] ||= ENV['SQS_QUEUE_NAME']
Shoryuken::EnvironmentLoader.setup_options(config_file: 'config/shoryuken.yml')
@LyricL-Gitster
Copy link
Author

should be located at config/initializers/shoryuken.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment