Sha256: 28370a6a6badd46a68a74f376ab40a1cbcc6a54f6789cfc3313f3c2111d93d9b

Contents?: true

Size: 1.2 KB

Versions: 22

Compression:

Stored size: 1.2 KB

Contents

if defined?(::Rails)
  Appsignal.logger.info("Loading Rails (#{Rails.version}) integration")

  require 'appsignal/rack/rails_instrumentation'

  module Appsignal
    module Integrations
      class Railtie < ::Rails::Railtie
        initializer 'appsignal.configure_rails_initialization' do |app|
          Appsignal::Integrations::Railtie.initialize_appsignal(app)
        end

        def self.initialize_appsignal(app)
          # Start logger
          Appsignal.start_logger(Rails.root.join('log'))

          # Load config
          Appsignal.config = Appsignal::Config.new(
            Rails.root,
            ENV.fetch('APPSIGNAL_APP_ENV', Rails.env),
            :name => Rails.application.class.parent_name
          )

          app.middleware.insert_before(
            ActionDispatch::RemoteIp,
            Appsignal::Rack::RailsInstrumentation
          )

          if Appsignal.config.active? &&
            Appsignal.config[:enable_frontend_error_catching] == true
            app.middleware.insert_before(
              Appsignal::Rack::RailsInstrumentation,
              Appsignal::Rack::JSExceptionCatcher,
            )
          end

          Appsignal.start
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
appsignal-0.12.beta.53 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.52 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.51 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.50 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.49 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.48 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.47 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.46 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.45 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.44 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.43 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.42 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.41 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.40 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.39 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.38 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.37 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.36 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.35 lib/appsignal/integrations/rails.rb
appsignal-0.12.beta.34 lib/appsignal/integrations/rails.rb