Sha256: f0d977f9d0ad50f58c70c7668fe0eb91ababa321afd37de49e57b4ea2e701436

Contents?: true

Size: 962 Bytes

Versions: 121

Compression:

Stored size: 962 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, {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
    end
  end
end

Version data entries

121 entries across 121 versions & 1 rubygems

Version Path
pact_broker-2.11.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.10.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.9.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.9.0.beta.5 lib/pact_broker/diagnostic/app.rb
pact_broker-2.8.0.beta.5 lib/pact_broker/diagnostic/app.rb
pact_broker-2.8.0.beta.4 lib/pact_broker/diagnostic/app.rb
pact_broker-2.7.0.beta.3 lib/pact_broker/diagnostic/app.rb
pact_broker-2.7.0.beta.2 lib/pact_broker/diagnostic/app.rb
pact_broker-2.7.0.beta.1 lib/pact_broker/diagnostic/app.rb
pact_broker-2.6.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.5.1 lib/pact_broker/diagnostic/app.rb
pact_broker-2.5.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.4.2 lib/pact_broker/diagnostic/app.rb
pact_broker-2.4.1 lib/pact_broker/diagnostic/app.rb
pact_broker-2.4.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.3.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.2.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.1.1 lib/pact_broker/diagnostic/app.rb
pact_broker-2.1.0 lib/pact_broker/diagnostic/app.rb
pact_broker-2.0.5 lib/pact_broker/diagnostic/app.rb