diff --git a/lib/httpclient/ssl_config.rb b/lib/httpclient/ssl_config.rb index f6e7ce92..c11dea2b 100644 --- a/lib/httpclient/ssl_config.rb +++ b/lib/httpclient/ssl_config.rb @@ -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