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-2.0.3 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.2 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.1 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.8 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.7 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.6 lib/pact_broker/diagnostic/app.rb
pact_broker-1.18.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/diagnostic/app.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/diagnostic/app.rb
pact_broker-1.17.2 lib/pact_broker/diagnostic/app.rb
pact_broker-1.17.1 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.4 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.3 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.2 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.0.beta.1 lib/pact_broker/diagnostic/app.rb
pact_broker-1.17.0 lib/pact_broker/diagnostic/app.rb
pact_broker-1.16.0 lib/pact_broker/diagnostic/app.rb
pact_broker-1.15.0 lib/pact_broker/diagnostic/app.rb
pact_broker-1.14.0 lib/pact_broker/diagnostic/app.rb