Sha256: 356519c67f221ed72a65b8085926a98ebee7ccdfbdec2081dc50f421c49a9a60

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 KB

Contents

module ZuoraConnect
  class Railtie < Rails::Railtie
    config.before_initialize do
      version = Rails.version
      if version >= "5.0.0"
        ::Rails.configuration.public_file_server.enabled = true
      elsif version >= "4.2.0"
        ::Rails.configuration.serve_static_files = true
      else
        ::Rails.configuration.serve_static_assets = true
      end
      ::Rails.configuration.action_dispatch.x_sendfile_header = nil
    end

    initializer(:rails_stdout_logging, before: :initialize_logger) do
      if true || Rails.env != 'development' && !ENV['DEIS_APP'].blank?
        require 'lograge'
        logger           = ActiveSupport::Logger.new(STDOUT)
        logger.formatter = ::Logger::Formatter.new
        Rails.configuration.logger = ActiveSupport::TaggedLogging.new(logger)
        Rails.configuration.lograge.enabled = true
        Rails.configuration.lograge.formatter = Lograge::Formatters::Json.new
        Rails.configuration.lograge.custom_options = lambda do |event|
          exceptions = %w(controller action format id)
          {
            appinstance_id: Thread.current[:appinstance].present? ? Thread.current[:appinstance].id : "Unknown",
            params: event.payload[:params].except(*exceptions),
            exception: event.payload[:exception],
            exception_object: event.payload[:exception_object]
          }
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zuora_connect-1.5.04 lib/zuora_connect/railtie.rb
zuora_connect-1.5.03a lib/zuora_connect/railtie.rb
zuora_connect-1.5.03 lib/zuora_connect/railtie.rb
zuora_connect-1.5.02 lib/zuora_connect/railtie.rb
zuora_connect-1.5.01 lib/zuora_connect/railtie.rb
zuora_connect-1.5.0 lib/zuora_connect/railtie.rb