Allow apps to override ca_file
This commit is contained in:
parent
d1ca5308e9
commit
e27109078a
|
@ -70,6 +70,9 @@ module Google
|
||||||
# The port number used by the client. This rarely needs to be changed.
|
# The port number used by the client. This rarely needs to be changed.
|
||||||
# @option options [String] :discovery_path ("/discovery/v1")
|
# @option options [String] :discovery_path ("/discovery/v1")
|
||||||
# The discovery base path. This rarely needs to be changed.
|
# The discovery base path. This rarely needs to be changed.
|
||||||
|
# @option options [String] :ca_file
|
||||||
|
# Optional set of root certificates to use when validating SSL connections.
|
||||||
|
# By default, a bundled set of trusted roots will be used.
|
||||||
def initialize(options={})
|
def initialize(options={})
|
||||||
logger.debug { "#{self.class} - Initializing client with options #{options}" }
|
logger.debug { "#{self.class} - Initializing client with options #{options}" }
|
||||||
|
|
||||||
|
@ -107,14 +110,13 @@ module Google
|
||||||
@discovery_uris = {}
|
@discovery_uris = {}
|
||||||
@discovery_documents = {}
|
@discovery_documents = {}
|
||||||
@discovered_apis = {}
|
@discovered_apis = {}
|
||||||
|
ca_file = options[:ca_file] || File.expand_path('../../cacerts.pem', __FILE__)
|
||||||
self.connection = Faraday.new do |faraday|
|
self.connection = Faraday.new do |faraday|
|
||||||
faraday.options.params_encoder = Faraday::FlatParamsEncoder
|
faraday.options.params_encoder = Faraday::FlatParamsEncoder
|
||||||
faraday.ssl.ca_file = File.expand_path('../../cacerts.pem', __FILE__)
|
faraday.ssl.ca_file = ca_file
|
||||||
faraday.ssl.verify = true
|
faraday.ssl.verify = true
|
||||||
faraday.adapter Faraday.default_adapter
|
faraday.adapter Faraday.default_adapter
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue