Skip to content

Commit 08e5420

Browse files
committed
feat(pact-broker cli): allow custom certificates to be used by setting SSL_CERT_FILE and SSL_CERT_DIR
Closes: #11
1 parent 4565e15 commit 08e5420

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packaging/pact-broker.rb

+13
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,17 @@ def basename
1212
end
1313
end
1414

15+
# Travelling Ruby sets its own CA cert bundle in lib/ruby/bin/ruby_environment
16+
# and creates backup environment variables for the original SSL_CERT values.
17+
# Restore the original values here *if they are present* so that we can connect to
18+
# a broker with a custom SSL certificate.
19+
20+
if ENV['ORIG_SSL_CERT_DIR'] && ENV['ORIG_SSL_CERT_DIR'] != ''
21+
ENV['SSL_CERT_DIR'] = ENV['ORIG_SSL_CERT_DIR']
22+
end
23+
24+
if ENV['ORIG_SSL_CERT_FILE'] && ENV['ORIG_SSL_CERT_FILE'] != ''
25+
ENV['SSL_CERT_FILE'] = ENV['ORIG_SSL_CERT_FILE']
26+
end
27+
1528
PactBroker::Client::CLI::Broker.start

0 commit comments

Comments
 (0)