Allow customizing SSL CA certificate

by adding a `ssl_ca_cert` configuration option
This commit is contained in:
xhh 2015-06-23 17:23:22 +08:00
parent 46869df631
commit 19ee56592e
4 changed files with 18 additions and 0 deletions

View File

@ -7,6 +7,14 @@ module {{moduleName}}
:scheme, :host, :base_path, :user_agent, :debug, :logger, :inject_format,
:force_ending_format, :camelize_params, :user_agent, :verify_ssl
# Set this to customize the certificate file to verify the peer.
#
# @return [String] the path to the certificate file
#
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
attr_accessor :ssl_ca_cert
# Defaults go in here..
def initialize
@format = 'json'

View File

@ -166,6 +166,7 @@ module {{moduleName}}
def make
request_options = {
:ssl_verifypeer => Swagger.configuration.verify_ssl,
:cainfo => Swagger.configuration.ssl_ca_cert,
:headers => self.headers.stringify_keys,
:verbose => Swagger.configuration.debug
}

View File

@ -7,6 +7,14 @@ module SwaggerClient
:scheme, :host, :base_path, :user_agent, :debug, :logger, :inject_format,
:force_ending_format, :camelize_params, :user_agent, :verify_ssl
# Set this to customize the certificate file to verify the peer.
#
# @return [String] the path to the certificate file
#
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
attr_accessor :ssl_ca_cert
# Defaults go in here..
def initialize
@format = 'json'

View File

@ -165,6 +165,7 @@ module SwaggerClient
def make
request_options = {
:ssl_verifypeer => Swagger.configuration.verify_ssl,
:cainfo => Swagger.configuration.ssl_ca_cert,
:headers => self.headers.stringify_keys,
:verbose => Swagger.configuration.debug
}