Skip to content

Commit

Permalink
Merge pull request #595 from jmsanders/add-endpoint-to-sqs-cli
Browse files Browse the repository at this point in the history
Add endpoint option to SQS CLI
  • Loading branch information
phstc authored Feb 20, 2020
2 parents af6ba75 + feb4020 commit a98ec09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/cli/sqs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Shoryuken
module CLI
class SQS < Base
namespace :sqs
class_option :endpoint, aliases: '-e', type: :string, default: ENV['SHORYUKEN_SQS_ENDPOINT'], desc: 'Endpoint URL'

no_commands do
def normalize_dump_message(message)
Expand All @@ -19,8 +20,15 @@ def normalize_dump_message(message)
}
end

def client_options
endpoint = options[:endpoint]
{}.tap do |hash|
hash[:endpoint] = endpoint unless endpoint.to_s.empty?
end
end

def sqs
@_sqs ||= Aws::SQS::Client.new
@_sqs ||= Aws::SQS::Client.new(client_options)
end

def find_queue_url(queue_name)
Expand Down

0 comments on commit a98ec09

Please sign in to comment.