From 164912be408b714851250dfae95ffa2de47e38cf Mon Sep 17 00:00:00 2001 From: mcclenney Date: Thu, 13 Feb 2020 15:15:18 -0600 Subject: [PATCH] feat: use certificates from SSL_CERT_FILE and SSL_CERT_DIR environment variables in HTTP connections --- lib/pact/hal/http_client.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pact/hal/http_client.rb b/lib/pact/hal/http_client.rb index 3225df3d..4d28b59b 100644 --- a/lib/pact/hal/http_client.rb +++ b/lib/pact/hal/http_client.rb @@ -50,6 +50,8 @@ def perform_request request, uri http = Net::HTTP.new(uri.host, uri.port, :ENV) http.set_debug_output(output_stream) if verbose http.use_ssl = (uri.scheme == 'https') + http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != '' + http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != '' http.start do |http| http.request request end