Sha256: 9514e4a05f03d31f5ef4fbaa26be84e51e909f0491caf74a868b588a099e3b0d

Contents?: true

Size: 1.2 KB

Versions: 14

Compression:

Stored size: 1.2 KB

Contents

module RailsBase
  module Configuration
    class ActiveJob < Base
      ACTIVE_JOB_PROC = Proc.new do |val, instance|
        if val.is_a?(Symbol)
          begin
            ::ActiveJob::QueueAdapters.lookup(val)
            Rails.configuration.active_job.queue_adapter = val.to_sym
          rescue StandardError => e
            raise ArgumentError, "config.app.active_job_adapter=#{val} is not a defined active job"
          end
        end
      end

      DEFAULT_VALUES = {
        enable_ui: {
          type: :boolean,
          default: true,
          description: 'All ActiveJob UI. To be used downstream'
        },
        view_ui: {
          type: :proc,
          default: ->(user) { user.at_least_owner? },
          dependents: [ -> (i) { i.enable_ui? }],
          description: 'All users to view ActiveJob UI. To be used downstream'
        },
        adapter: {
          type: :symbol_class,
          default: ENV['USE_SIDEKIQ']=='true' ? :sidekiq : :inline,
          on_assignment: ACTIVE_JOB_PROC,
          description: 'Active job adapter. This expects a symbol or a class that inherits from ActiveJob::QueueAdapters'
        },
      }

      attr_accessor *DEFAULT_VALUES.keys
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rails_base-0.61.0 lib/rails_base/configuration/active_job.rb
rails_base-0.60.0 lib/rails_base/configuration/active_job.rb
rails_base-0.58.0 lib/rails_base/configuration/active_job.rb
rails_base-0.57.0 lib/rails_base/configuration/active_job.rb
rails_base-0.56.0 lib/rails_base/configuration/active_job.rb
rails_base-0.55.0 lib/rails_base/configuration/active_job.rb
rails_base-0.54.0 lib/rails_base/configuration/active_job.rb
rails_base-0.53.1 lib/rails_base/configuration/active_job.rb
rails_base-0.53.0 lib/rails_base/configuration/active_job.rb
rails_base-0.52.3 lib/rails_base/configuration/active_job.rb
rails_base-0.52.1 lib/rails_base/configuration/active_job.rb
rails_base-0.52.0 lib/rails_base/configuration/active_job.rb
rails_base-0.51.1 lib/rails_base/configuration/active_job.rb
rails_base-0.51.0 lib/rails_base/configuration/active_job.rb