Sha256: 37ad6b97f20882de82b5bb0150f76a71358ede86c43f7f469d9902c2139dc64e

Contents?: true

Size: 877 Bytes

Versions: 30

Compression:

Stored size: 877 Bytes

Contents

require 'pact_broker/diagnostic/resources/heartbeat'
require 'pact_broker/diagnostic/resources/dependencies'
require 'webmachine/adapters/rack_mapped'

module PactBroker
  module Diagnostic

    class App
      def initialize
        @app = build_diagnostic_app
      end

      def call env
        if env['PATH_INFO'].start_with? "/diagnostic/"
          @app.call(env)
        else
          [404, {}, []]
        end
      end

      def build_diagnostic_app
        app = Webmachine::Application.new do |app|
          app.routes do
            add ['diagnostic','status','heartbeat'], Diagnostic::Resources::Heartbeat
            add ['diagnostic','status','dependencies'], Diagnostic::Resources::Dependencies
          end
        end

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

        app.adapter
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
pact_broker-1.13.0 lib/pact_broker/diagnostic/app.rb
pact_broker-1.12.0 lib/pact_broker/diagnostic/app.rb
pact_broker-1.11.2 lib/pact_broker/diagnostic/app.rb
pact_broker-1.11.1 lib/pact_broker/diagnostic/app.rb
pact_broker-1.11.0 lib/pact_broker/diagnostic/app.rb
pact_broker-1.10.0 lib/pact_broker/diagnostic/app.rb
pact_broker-1.9.3 lib/pact_broker/diagnostic/app.rb
pact_broker-1.9.2 lib/pact_broker/diagnostic/app.rb
pact_broker-1.9.1 lib/pact_broker/diagnostic/app.rb
pact_broker-1.9.0 lib/pact_broker/diagnostic/app.rb