class Aws::Rails::SqsActiveJob::Configuration

Use Aws::Rails::SqsActiveJob.config to access the singleton config instance.
Configuration for AWS SQS ActiveJob.

def client

def client
  @client ||= begin
    client = Aws::SQS::Client.new
    client.config.user_agent_frameworks << 'aws-sdk-rails'
    client
  end
end

def config_file

def config_file
  file = ::Rails.root.join("config/aws_sqs_active_job/#{::Rails.env}.yml")
  file = ::Rails.root.join('config/aws_sqs_active_job.yml') unless File.exist?(file)
  file
end

def config_file_path(options)

Returns:
  • (String) - Configuration path found in environment or YAML file.
def config_file_path(options)
  options[:config_file] || ENV.fetch('AWS_SQS_ACTIVE_JOB_CONFIG_FILE', nil)
end

def excluded_deduplication_keys=(keys)

def excluded_deduplication_keys=(keys)
  @excluded_deduplication_keys = keys.map(&:to_s) | ['job_id']
end

def file_options(options = {})

def file_options(options = {})
  file_path = config_file_path(options)
  if file_path
    load_from_file(file_path)
  else
    {}
  end
end

def initialize(options = {})

def initialize(options = {})
  options[:config_file] ||= config_file if File.exist?(config_file)
  options = DEFAULTS
            .merge(file_options(options))
            .merge(options)
  set_attributes(options)
end

def load_from_file(file_path)

Load options from YAML file
def load_from_file(file_path)
  opts = load_yaml(file_path) || {}
  opts.deep_symbolize_keys
end

def load_yaml(file_path)

def load_yaml(file_path)
  require 'erb'
  source = ERB.new(File.read(file_path)).result
  # Avoid incompatible changes with Psych 4.0.0
  # https://bugs.ruby-lang.org/issues/17866
  # rubocop:disable Security/YAMLLoad
  begin
    YAML.load(source, aliases: true) || {}
  rescue ArgumentError
    YAML.load(source) || {}
  end
  # rubocop:enable Security/YAMLLoad
end

def queue_url_for(job_queue)

Return the queue_url for a given job_queue name
def queue_url_for(job_queue)
  job_queue = job_queue.to_sym
  raise ArgumentError, "No queue defined for #{job_queue}" unless queues.key? job_queue
  queues[job_queue]
end

def set_attributes(options)

Set accessible attributes after merged options.
def set_attributes(options)
  options.each_key do |opt_name|
    instance_variable_set("@#{opt_name}", options[opt_name])
    client.config.user_agent_frameworks << 'aws-sdk-rails' if opt_name == :client
  end
end

def to_h

Other tags:
    Api: - private
def to_h
  h = {}
  instance_variables.each do |v|
    v_sym = v.to_s.gsub('@', '').to_sym
    val = instance_variable_get(v)
    h[v_sym] = val
  end
  h
end

def to_s

Other tags:
    Api: - private
def to_s
  to_h.to_s
end