Sha256: a26996d23c8c6aad75b0e2d8eddedd433c80a37992776ca7e5c6ccfcf45a4c01

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true

class Memolog::Init
  def call
    init_rails!
    init_sentry!
    init_sidekiq!
  end

  private

  def init_rails!
    return unless defined?(Rails) && Memolog.config.initializers.include?(:rails)
    Rails.application.middleware.insert_before(0, Memolog::Middleware)
  end

  def init_sentry!
    return unless defined?(Sentry::Scope) && Memolog.config.initializers.include?(:sentry)
    Sentry::Scope.prepend(Memolog::SentryScopeExtension)
  end

  def init_sidekiq!
    return unless defined?(Sidekiq) && Memolog.config.initializers.include?(:sidekiq)

    Sidekiq.configure_server do |config|
      config.server_middleware do |chain|
        chain.prepend(Memolog::SentrySidekiqMiddleware)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
memolog-0.2.1 lib/memolog/init.rb