summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTristan Hill <tristan.hill@bbc.co.uk>2017-07-20 10:23:46 +0100
committerTristan Hill <tristan.hill@bbc.co.uk>2017-07-24 16:50:41 +0100
commit4a55f61c549dce560fecc905168de5b83e4fb7a4 (patch)
tree98f9ed0c3716b2c43cbf6dc74f22eea83f12986c /lib
parent53dfec6917c9fd2795856cbd776cff2029a0416e (diff)
downloadbundler-4a55f61c549dce560fecc905168de5b83e4fb7a4.tar.gz
Use ssl client cert and ca cert settings from gem configuration as fallbacks
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/fetcher.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb
index 01a0679f7c..5a9617c60a 100644
--- a/lib/bundler/fetcher.rb
+++ b/lib/bundler/fetcher.rb
@@ -249,8 +249,11 @@ module Bundler
con.cert_store = bundler_cert_store
end
- if Bundler.settings[:ssl_client_cert]
- pem = File.read(Bundler.settings[:ssl_client_cert])
+ ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
+ (Bundler.rubygems.configuration.ssl_client_cert if
+ Bundler.rubygems.configuration.respond_to?(:ssl_client_cert))
+ if ssl_client_cert
+ pem = File.read(ssl_client_cert)
con.cert = OpenSSL::X509::Certificate.new(pem)
con.key = OpenSSL::PKey::RSA.new(pem)
end
@@ -279,11 +282,14 @@ module Bundler
def bundler_cert_store
store = OpenSSL::X509::Store.new
- if Bundler.settings[:ssl_ca_cert]
- if File.directory? Bundler.settings[:ssl_ca_cert]
- store.add_path Bundler.settings[:ssl_ca_cert]
+ ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
+ (Bundler.rubygems.configuration.ssl_ca_cert if
+ Bundler.rubygems.configuration.respond_to?(:ssl_ca_cert))
+ if ssl_ca_cert
+ if File.directory? ssl_ca_cert
+ store.add_path ssl_ca_cert
else
- store.add_file Bundler.settings[:ssl_ca_cert]
+ store.add_file ssl_ca_cert
end
else
store.set_default_paths