-
-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:phstc/shoryuken into strict_prior…
…ity_polling # Conflicts: # lib/shoryuken/fetcher.rb # lib/shoryuken/manager.rb # lib/shoryuken/polling.rb # spec/shoryuken/polling_spec.rb
- Loading branch information
Showing
25 changed files
with
377 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
engines: | ||
brakeman: | ||
enabled: true | ||
bundler-audit: | ||
enabled: true | ||
duplication: | ||
enabled: true | ||
config: | ||
languages: | ||
- ruby | ||
fixme: | ||
enabled: true | ||
reek: | ||
enabled: true | ||
rubocop: | ||
enabled: true | ||
ratings: | ||
paths: | ||
- "**.rb" | ||
# exclude_paths: | ||
# - "**/vendor/**/*" | ||
# - "*/spec/**/*" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ gemspec | |
|
||
group :test do | ||
gem 'codeclimate-test-reporter', require: nil | ||
gem 'simplecov' | ||
gem 'multi_xml' | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# frozen_string_literal: true | ||
module Shoryuken | ||
class AwsConfig | ||
class << self | ||
attr_writer :options | ||
|
||
def options | ||
@options ||= {} | ||
end | ||
|
||
def setup(hash) | ||
# aws-sdk tries to load the credentials from the ENV variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY | ||
# when not explicit supplied | ||
return if hash.empty? | ||
|
||
self.options = hash | ||
|
||
shoryuken_keys = %w( | ||
account_id | ||
sns_endpoint | ||
sqs_endpoint | ||
receive_message | ||
).map(&:to_sym) | ||
|
||
@aws_options = hash.reject do |k, _| | ||
shoryuken_keys.include?(k) | ||
end | ||
|
||
# assume credentials based authentication | ||
credentials = Aws::Credentials.new( | ||
@aws_options.delete(:access_key_id), | ||
@aws_options.delete(:secret_access_key) | ||
) | ||
|
||
# but only if the configuration options have valid values | ||
@aws_options.merge!(credentials: credentials) if credentials.set? | ||
|
||
if (callback = Shoryuken.aws_initialization_callback) | ||
Shoryuken.logger.info { 'Calling Shoryuken.on_aws_initialization block' } | ||
callback.call(@aws_options) | ||
end | ||
end | ||
|
||
def sns | ||
Aws::SNS::Client.new(aws_client_options(:sns_endpoint)) | ||
end | ||
|
||
def sqs | ||
Aws::SQS::Client.new(aws_client_options(:sqs_endpoint)) | ||
end | ||
|
||
private | ||
|
||
def aws_client_options(service_endpoint_key) | ||
environment_endpoint = ENV["AWS_#{service_endpoint_key.to_s.upcase}"] | ||
explicit_endpoint = options[service_endpoint_key] || environment_endpoint | ||
endpoint = {}.tap do |hash| | ||
hash[:endpoint] = explicit_endpoint unless explicit_endpoint.to_s.empty? | ||
end | ||
@aws_options.to_h.merge(endpoint) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.