Sha256: 592654f350b1a05380911f8127dc0dbbf0e71f71d050970b4f95b32913cbe35b
Contents?: true
Size: 937 Bytes
Versions: 9
Compression:
Stored size: 937 Bytes
Contents
# frozen_string_literal: true module RailsServerMonitor class RackMiddleware def initialize(app) @app = app end def call(env) request = ActionDispatch::Request.new(env) return @app.call(request.env) if ignore_request?(request) server = RailsServerMonitor::ServerSetup.new.call snapshot = RailsServerMonitor::TakeSnapshot.new(server) if snapshot.can_take_snapshot? snapshot.call RailsServerMonitor::Cleanup.new.call end @app.call(request.env) end def ignore_request?(request) return false if config.ignore_urls.blank? path = request.path return true if config.ignore_urls.detect do |url| if url.is_a?(String) next path == url elsif url.is_a?(Regexp) next url.match?(path) end end.present? false end def config RailsServerMonitor.config end end end
Version data entries
9 entries across 9 versions & 1 rubygems