Class: Sidekiq::EncryptedArgs::ClientMiddleware
- Inherits:
-
Object
- Object
- Sidekiq::EncryptedArgs::ClientMiddleware
- Defined in:
- lib/sidekiq/encrypted_args/client_middleware.rb
Overview
Sidekiq client middleware for encrypting arguments on jobs for workers with encrypted_args set in the sidekiq_options.
Instance Method Summary collapse
Instance Method Details
#call(worker_class, job, queue, redis_pool = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sidekiq/encrypted_args/client_middleware.rb', line 9 def call(worker_class, job, queue, redis_pool = nil) worker_class = constantize(worker_class) if worker_class.is_a?(String) encrypted_args = EncryptedArgs.send(:encrypted_args_option, worker_class) if encrypted_args new_args = [] job["args"].each_with_index do |value, position| value = EncryptedArgs.encrypt(value) if encrypted_args[position] new_args << value end job["args"] = new_args end yield end |