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 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) { params: event.payload[:params].except(*exceptions), exception: event.payload[:exception], exception_object: event.payload[:exception_object] } end end end end end