Class: RailsBase::Configuration::ActiveJob

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_base/configuration/active_job.rb

Constant Summary collapse

ACTIVE_JOB_PROC =
Proc.new do |val, instance|
  if val.is_a?(Symbol)
    begin
      ::ActiveJob::QueueAdapters.lookup(val)
      RailsBase::ApplicationJob.queue_adapter = val.to_sym
      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'
  },
}

Constants inherited from Base

Base::ALLOWED_TYPES

Method Summary

Methods inherited from Base

_allow_write_block?, _unset_allow_write!, #assign_default_values!, #dig, #initialize, #override_methods!, #validate!

Constructor Details

This class inherits a constructor from RailsBase::Configuration::Base