Skip to content

Commit

Permalink
[ssl] respect SSL_CERT_DIR and SSL_CERT_FILE
Browse files Browse the repository at this point in the history
respect SSL_CERT_DIR and SSL_CERT_FILE environment variables
  • Loading branch information
mikz committed Feb 27, 2018
1 parent 398256a commit 83a2331
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/httpclient/ssl_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,15 @@ def change_notify

# Use 2048 bit certs trust anchor
def load_cacerts(cert_store)
file = File.join(File.dirname(__FILE__), 'cacert.pem')
add_trust_ca_to_store(cert_store, file)
certs = if ENV.key?('SSL_CERT_DIR'.freeze) || ENV.key?('SSL_CERT_FILE')
[ ENV['SSL_CERT_DIR'.freeze], ENV['SSL_CERT_FILE'] ].compact
else
[ File.join(File.dirname(__FILE__), 'cacert.pem') ]
end

certs.each do |cert|
add_trust_ca_to_store(cert_store, cert)
end
end
end

Expand Down

0 comments on commit 83a2331

Please sign in to comment.