Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes secrets to credentials for Rails 7.2 support #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The snippet below shows the various configurable settings and their defaults.
config.active_elastic_job.process_jobs = ENV['PROCESS_ACTIVE_ELASTIC_JOBS'] == 'true'
config.active_elastic_job.aws_credentials = lambda { Aws::InstanceProfileCredentials.new } # allows lambdas for lazy loading
config.active_elastic_job.aws_region # no default
config.active_elastic_job.secret_key_base = Rails.application.secrets[:secret_key_base]
config.active_elastic_job.secret_key_base = Rails.application.credentials[:secret_key_base]
config.active_elastic_job.periodic_tasks_route = '/periodic_tasks'.freeze
end
```
Expand Down
6 changes: 3 additions & 3 deletions lib/active_elastic_job/rack/sqs_message_consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module Rack
# (2) the processed SQS message was queued by this gem representing an active job.
# In this case it verifies the digest which is sent along with a legit SQS
# message, and passed as an HTTP header in the resulting request.
# The digest is based on Rails' +secrets.secret_key_base+.
# The digest is based on Rails' +credentials.secret_key_base+.
# Therefore, the application running in the web environment, which generates
# the digest, and the application running in the worker
# environment, which verifies the digest, have to use the *same*
# +secrets.secret_key_base+ setting.
# +credentials.secret_key_base+ setting.
class SqsMessageConsumer
OK_RESPONSE = [ '200'.freeze, { 'Content-Type'.freeze => 'text/plain'.freeze }, [ 'OK'.freeze ] ]
FORBIDDEN_RESPONSE = [
Expand Down Expand Up @@ -47,7 +47,7 @@ def call(env) #:nodoc:
rescue ActiveElasticJob::MessageVerifier::InvalidDigest => e
return FORBIDDEN_RESPONSE
end
return OK_RESPONSE
return OK_RESPONSE
end
end
@app.call(env)
Expand Down
2 changes: 1 addition & 1 deletion lib/active_elastic_job/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Railtie < Rails::Railtie

initializer "active_elastic_job.insert_middleware" do |app|
if app.config.active_elastic_job.secret_key_base.blank?
app.config.active_elastic_job.secret_key_base = app.secrets[:secret_key_base]
app.config.active_elastic_job.secret_key_base = app.credentials[:secret_key_base]
end

if app.config.active_elastic_job.process_jobs == true
Expand Down