From 308f25dbab8c8f3d2d1ee25f80548a654a2ecd2d Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Tue, 18 Feb 2020 08:58:45 +1100 Subject: [PATCH] feat: use environment variables PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD when verifying a pact by URL, if the environment variables are present --- lib/pact/cli/run_pact_verification.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pact/cli/run_pact_verification.rb b/lib/pact/cli/run_pact_verification.rb index f56d094d..4b5f47ae 100644 --- a/lib/pact/cli/run_pact_verification.rb +++ b/lib/pact/cli/run_pact_verification.rb @@ -56,9 +56,11 @@ def run_specs def run_with_pact_url_string pact_repository_uri_options = {} + pact_repository_uri_options[:username] = ENV['PACT_BROKER_USERNAME'] if ENV['PACT_BROKER_USERNAME'] + pact_repository_uri_options[:password] = ENV['PACT_BROKER_PASSWORD'] if ENV['PACT_BROKER_PASSWORD'] + pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN'] pact_repository_uri_options[:username] = options[:pact_broker_username] if options[:pact_broker_username] pact_repository_uri_options[:password] = options[:pact_broker_password] if options[:pact_broker_password] - pact_repository_uri_options[:token] = ENV['PACT_BROKER_TOKEN'] pact_uri = ::Pact::Provider::PactURI.new(options[:pact_uri], pact_repository_uri_options) Pact::Provider::PactSpecRunner.new([pact_uri], pact_spec_options).run end