Sha256: 91c2506a19187c868700dd2483c352f8c8ec2a210daadeaf4c3507ca232cb5b2
Contents?: true
Size: 967 Bytes
Versions: 1
Compression:
Stored size: 967 Bytes
Contents
# frozen_string_literal: true module Msgr class Railtie < ::Rails::Railtie config.msgr = ActiveSupport::OrderedOptions.new DEFAULT_OPTIONS = { checkcredentials: true, routing_file: "#{Rails.root}/config/msgr.rb" }.freeze if File.exist?("#{Rails.root}/app/consumers") config.autoload_paths << File.expand_path("#{Rails.root}/app/consumers") end initializer 'msgr.logger' do |app| app.config.msgr.logger ||= Rails.logger end initializer 'msgr.start' do config.after_initialize do |app| Msgr.logger = app.config.msgr.logger self.class.load(app.config_for(:rabbitmq)) end end rake_tasks do load File.expand_path('tasks/msgr/drain.rake', __dir__) end class << self def load(config) config = DEFAULT_OPTIONS.merge(config) Msgr.config = config Msgr.client.connect if config.fetch(:checkcredentials) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
msgr-1.3.0 | lib/msgr/railtie.rb |