2018-12-14 05:06:12 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-28 21:29:22 -05:00
|
|
|
require "rails"
|
|
|
|
require "action_controller/railtie"
|
|
|
|
require "active_job/railtie"
|
|
|
|
require "active_record/railtie"
|
|
|
|
require "active_storage/engine"
|
|
|
|
|
2018-12-24 15:16:22 -05:00
|
|
|
require "action_mailbox"
|
2018-09-28 15:19:43 -04:00
|
|
|
|
|
|
|
module ActionMailbox
|
|
|
|
class Engine < Rails::Engine
|
|
|
|
isolate_namespace ActionMailbox
|
|
|
|
config.eager_load_namespaces << ActionMailbox
|
|
|
|
|
2018-10-01 08:16:10 -04:00
|
|
|
config.action_mailbox = ActiveSupport::OrderedOptions.new
|
2019-02-06 19:28:49 -05:00
|
|
|
config.action_mailbox.incinerate = true
|
2018-10-06 22:23:19 -04:00
|
|
|
config.action_mailbox.incinerate_after = 30.days
|
2018-10-01 08:16:10 -04:00
|
|
|
|
2018-11-11 18:23:13 -05:00
|
|
|
config.action_mailbox.queues = ActiveSupport::InheritableOptions.new \
|
|
|
|
incineration: :action_mailbox_incineration, routing: :action_mailbox_routing
|
|
|
|
|
2018-09-28 15:19:43 -04:00
|
|
|
initializer "action_mailbox.config" do
|
|
|
|
config.after_initialize do |app|
|
2018-10-01 08:16:10 -04:00
|
|
|
ActionMailbox.logger = app.config.action_mailbox.logger || Rails.logger
|
2019-02-06 19:28:49 -05:00
|
|
|
ActionMailbox.incinerate = app.config.action_mailbox.incinerate.nil? ? true : app.config.action_mailbox.incinerate
|
2018-10-06 22:23:19 -04:00
|
|
|
ActionMailbox.incinerate_after = app.config.action_mailbox.incinerate_after || 30.days
|
2018-11-11 18:23:13 -05:00
|
|
|
ActionMailbox.queues = app.config.action_mailbox.queues || {}
|
2019-04-14 12:15:54 -04:00
|
|
|
ActionMailbox.ingress = app.config.action_mailbox.ingress
|
2018-11-05 12:39:37 -05:00
|
|
|
end
|
|
|
|
end
|
2018-09-28 15:19:43 -04:00
|
|
|
end
|
|
|
|
end
|