Sha256: 85e6f1fe91d7fddc3d274c306b0ede50d243486c8404f4d6c74b34d60cce006c

Contents?: true

Size: 830 Bytes

Versions: 34

Compression:

Stored size: 830 Bytes

Contents

require "pact_broker/logging"

module PactBroker
  module Api
    module Middleware
      class Configuration
        include PactBroker::Logging

        def initialize(app, configuration)
          @app = app
          @configuration = configuration
        end

        def call(env)
          if (overrides = env["pactbroker.configuration_overrides"])&.any?
            dupped_configuration = configuration.dup
            dupped_configuration.override_runtime_configuration!(overrides)
            dupped_configuration.freeze
            PactBroker.set_configuration(dupped_configuration)
            app.call(env)
          else
            PactBroker.set_configuration(configuration)
            app.call(env)
          end
        end

        private

        attr_reader :app, :configuration
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pact_broker-2.93.3 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.93.2 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.93.1 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.93.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.92.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.91.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.90.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.89.1 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.89.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.88.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.87.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.86.0 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.85.1 lib/pact_broker/api/middleware/configuration.rb
pact_broker-2.85.0 lib/pact_broker/api/middleware/configuration.rb