Sha256: 2a13e6a0296c37b98ea1fc4365661f71d9b1da6418abcb14b7b7d6460f01cda5

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require "rails"
require "prosopite"

require_relative "middleware"
require_relative "prosopite_logger"

module Dial
  class Railtie < ::Rails::Railtie
    initializer "dial.use_middleware" do |app|
      app.middleware.insert_before 0, Middleware
    end

    initializer "dial.set_up_vernier" do |app|
      app.config.after_initialize do
        FileUtils.mkdir_p ::Rails.root.join PROFILE_OUT_RELATIVE_DIRNAME
      end
    end

    initializer "dial.set_up_prosopite" do |app|
      app.config.after_initialize do
        if ::ActiveRecord::Base.connection.adapter_name == "PostgreSQL"
          require "pg_query"
        end

        prosopite_log_pathname = ::Rails.root.join PROSOPITE_LOG_RELATIVE_PATHNAME
        FileUtils.mkdir_p File.dirname prosopite_log_pathname
        FileUtils.touch prosopite_log_pathname
        ::Prosopite.custom_logger = ProsopiteLogger.new prosopite_log_pathname

        ::Prosopite.ignore_queries = PROSOPITE_IGNORE_QUERIES
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dial-0.1.4 lib/dial/railtie.rb