class PactBroker::Diagnostic::App

Public Class Methods

new() click to toggle source
# File lib/pact_broker/diagnostic/app.rb, line 9
def initialize
  @app = build_diagnostic_app
end

Public Instance Methods

build_diagnostic_app() click to toggle source
# File lib/pact_broker/diagnostic/app.rb, line 21
def build_diagnostic_app
  app = Webmachine::Application.new do |webmachine_app|
    webmachine_app.routes do
      add ["diagnostic","status","heartbeat"], Diagnostic::Resources::Heartbeat, {resource_name: "diagnostic_heartbeat"}
      add ["diagnostic","status","dependencies"], Diagnostic::Resources::Dependencies, {resource_name: "diagnostic_dependencies"}
    end
  end

  app.configure do |config|
    config.adapter = :RackMapped
  end

  app.adapter
end
call(env) click to toggle source
# File lib/pact_broker/diagnostic/app.rb, line 13
def call env
  if env["PATH_INFO"].start_with? "/diagnostic/"
    @app.call(env)
  else
    [404, {}, []]
  end
end