Skip to content

Commit 308f25d

Browse files
committed
feat: use environment variables PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD when verifying a pact by URL, if the environment variables are present
1 parent d494300 commit 308f25d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/pact/cli/run_pact_verification.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ def run_specs
5656

5757
def run_with_pact_url_string
5858
pact_repository_uri_options = {}
59+
pact_repository_uri_options[:username] = ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME']
60+
pact_repository_uri_options[:password] = ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD']
61+
pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN']
5962
pact_repository_uri_options[:username] = options[:pact_broker_username] if options[:pact_broker_username]
6063
pact_repository_uri_options[:password] = options[:pact_broker_password] if options[:pact_broker_password]
61-
pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN']
6264
pact_uri = ::Pact::Provider::PactURI.new(options[:pact_uri], pact_repository_uri_options)
6365
Pact::Provider::PactSpecRunner.new([pact_uri], pact_spec_options).run
6466
end

0 commit comments

Comments
 (0)