Permalink
Browse files

Added a configuration to be able to set ssl certificate to use

  • Loading branch information...
1 parent 1f5dcfc commit 8840ced4f41b9a780c39214f915cc8353662eec7 @ratnikov committed Jan 10, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −0 lib/httpadapter.rb
  2. +1 −1 lib/httpadapter/adapters/net_http.rb
  3. +9 −0 lib/httpadapter/config.rb
View
@@ -13,6 +13,7 @@
# limitations under the License.
+require 'httpadapter/config'
require 'httpadapter/version'
require 'httpadapter/connection'
@@ -217,7 +217,7 @@ def fetch_resource(request_ary, connection=nil)
http.enable_post_connection_check = true
end
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
- ca_file = File.expand_path(ENV['CA_FILE'] || '~/.cacert.pem')
+ ca_file = HTTPAdapter::Config.ssl_certificate
if File.exists?(ca_file)
http.ca_file = ca_file
end
@@ -0,0 +1,9 @@
+module HTTPAdapter::Config
+ extend self
+
+ attr_writer :ssl_certificate
+
+ def ssl_certificate
+ @ssl_certificate ||= File.expand_path(ENV['CA_FILE'] || '~/.cacert.pem')
+ end
+end

0 comments on commit 8840ced

Please sign in to comment.