Sha256: 15d9a5b1c5b38648646c42737c8a01f7daaacb078a09caea90d676b5aa886f57

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

Appsignal.logger.info("Loading Rails (#{Rails.version}) integration")

require "appsignal/utils/rails_helper"
require "appsignal/rack/rails_instrumentation"

module Appsignal
  module Integrations
    # @api private
    class Railtie < ::Rails::Railtie
      initializer "appsignal.configure_rails_initialization" do |app|
        Appsignal::Integrations::Railtie.initialize_appsignal(app)
      end

      def self.initialize_appsignal(app)
        # Load config
        Appsignal.config = Appsignal::Config.new(
          Rails.root,
          Rails.env,
          :name => Appsignal::Utils::RailsHelper.detected_rails_app_name,
          :log_path => Rails.root.join("log")
        )

        # Start logger
        Appsignal.start_logger

        app.middleware.insert_after(
          ActionDispatch::DebugExceptions,
          Appsignal::Rack::RailsInstrumentation
        )

        if Appsignal.config[:enable_frontend_error_catching]
          app.middleware.insert_before(Appsignal::Rack::RailsInstrumentation)
        end

        Appsignal.start
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
appsignal-3.0.1-java lib/appsignal/integrations/railtie.rb
appsignal-3.0.1 lib/appsignal/integrations/railtie.rb
appsignal-3.0.0-java lib/appsignal/integrations/railtie.rb
appsignal-3.0.0 lib/appsignal/integrations/railtie.rb
appsignal-3.0.0.rc.1 lib/appsignal/integrations/railtie.rb
appsignal-3.0.0.rc.1-java lib/appsignal/integrations/railtie.rb
appsignal-3.0.0.beta.1 lib/appsignal/integrations/railtie.rb
appsignal-3.0.0.beta.1-java lib/appsignal/integrations/railtie.rb