Websites/lib/middleware/silence_good_job_logging.rb

22 lines
472 B
Ruby

# frozen_string_literal: true
module Middleware
class SilenceGoodJobLogging
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
host = request.env["websites.dev_host"].presence || request.host
if host == OtherRoutes::ADMIN_DOMAIN && env["PATH_INFO"].start_with?("/jobs")
Rails.logger.silence do
@app.call(env)
end
else
@app.call(env)
end
end
end
end