active_elastic_job 1.6.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6847a7a87f3a4b268f17b0e1051c1947738c3ec
4
- data.tar.gz: e6017460930225630f39d9b4994ec2eb6e92005b
3
+ metadata.gz: 33d8c9fbb99bf26f435b6ec527e34022b1967473
4
+ data.tar.gz: e87b6fb000e3ee8feac2b549af57b83852358c72
5
5
  SHA512:
6
- metadata.gz: 784f598655f40226151c63d094432a239ecb22bbb3d8104d1d09f81ce68e1fc7603f788fef0a045f2e06a0e8b9f3248d73709df89a23111cadaef62d16719cb8
7
- data.tar.gz: 4256d0370e0e926f7fc287fe05da0ca4bd8020c7d91de32a242f2185fe5e991d863e3c3a8357ebcf0e5dd555d68bcaf32cdf06e676fb411f5900af0484966ff3
6
+ metadata.gz: ca2572266cbfd44cfa04270ece01d0e99c26f6768ac6d20aa4f7fd3969130ff5afb2d82f11ac3ba092ddf2378dedeada37c344844a677aebf4e73b650ee50cde
7
+ data.tar.gz: 068c7a6062081d4d0196d4a865179515f89b9a93375aa55574cd6a724c9316295d56a3b277aaf01c9debf882ed337e00741caf6f83e8111517b2bc920b38fa23
@@ -1,7 +1,13 @@
1
1
  module ActiveElasticJob
2
2
  class Railtie < Rails::Railtie
3
+ config.active_elastic_job = ActiveSupport::OrderedOptions.new
4
+ config.active_elastic_job.aws_region = ENV['AWS_REGION']
5
+ config.active_elastic_job.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
6
+ config.active_elastic_job.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] || ENV['AWS_SECRET_KEY'] || ENV['AMAZON_SECRET_ACCESS_KEY']
7
+ config.active_elastic_job.disable_sqs_confumer = ENV['DISABLE_SQS_CONSUMER']
8
+
3
9
  initializer "active_elastic_job.insert_middleware" do |app|
4
- disabled = ENV['DISABLE_SQS_CONSUMER']
10
+ disabled = app.config.active_elastic_job.disable_sqs_confumer
5
11
  if disabled == 'false' || disabled.nil?
6
12
  if app.config.force_ssl
7
13
  app.config.middleware.insert_before(ActionDispatch::SSL,ActiveElasticJob::Rack::SqsMessageConsumer)
@@ -1,8 +1,8 @@
1
1
  module ActiveElasticJob
2
2
  module VERSION
3
3
  MAJOR = 1
4
- MINOR = 6
5
- TINY = 3
4
+ MINOR = 7
5
+ TINY = 0
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@@ -171,12 +171,17 @@ module ActiveJob
171
171
  end
172
172
 
173
173
  def aws_sqs_client
174
- @aws_key ||= ENV['AWS_SECRET_ACCESS_KEY'] || ENV['AWS_SECRET_KEY'] || ENV['AMAZON_SECRET_ACCESS_KEY']
175
- @aws_sqs_client ||= Aws::SQS::Client.new(
176
- access_key_id: ENV['AWS_ACCESS_KEY_ID'],
177
- secret_access_key: @aws_key,
178
- region: ENV['AWS_REGION']
179
- )
174
+ c = Rails.application.config.active_elastic_job
175
+ @aws_sqs_client ||= if c.aws_credentials.present?
176
+ Aws::SQS::Client.new(
177
+ credentials: c.aws_credentials,
178
+ region: c.aws_region)
179
+ else
180
+ Aws::SQS::Client.new(
181
+ access_key_id: c.aws_access_key_id,
182
+ secret_access_key: c.aws_secret_access_key,
183
+ region: c.aws_region)
184
+ end
180
185
  end
181
186
 
182
187
  def message_digest(messsage_body)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_elastic_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tawan Sierek