Sha256: a72c550ace7b38581a794ca27cc30a7448c42e11c18c9fe9a1f68908a29c7ffc

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

require 'rails'
require 'yaml'

require 'honeybadger/ruby'

module Honeybadger
  module Init
    module Rails
      class Railtie < ::Rails::Railtie
        rake_tasks do
          load 'honeybadger/tasks.rb'
        end

        initializer 'honeybadger.install_middleware' do |app|
          honeybadger_config = Honeybadger::Agent.instance.config

          app.config.middleware.insert(0, Honeybadger::Rack::ErrorNotifier)
          app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserInformer) if honeybadger_config[:'user_informer.enabled']
          app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserFeedback) if honeybadger_config[:'feedback.enabled']
        end

        config.before_initialize do
          Honeybadger.init!({
            :root           => ::Rails.root.to_s,
            :env            => ::Rails.env,
            :'config.path'  => ::Rails.root.join('config', 'honeybadger.yml'),
            :logger         => Logging::FormattedLogger.new(::Rails.logger),
            :framework      => :rails
          })
        end

        config.after_initialize do
          Honeybadger.load_plugins!
        end
      end
    end
  end
end

Honeybadger.install_at_exit_callback

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
honeybadger-5.13.2 lib/honeybadger/init/rails.rb
honeybadger-5.13.1 lib/honeybadger/init/rails.rb
honeybadger-5.13.0 lib/honeybadger/init/rails.rb
honeybadger-5.12.0 lib/honeybadger/init/rails.rb
honeybadger-5.11.2 lib/honeybadger/init/rails.rb
honeybadger-5.11.1 lib/honeybadger/init/rails.rb
honeybadger-5.11.0 lib/honeybadger/init/rails.rb