summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-08-07 14:11:38 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-08-07 14:11:38 -0300
commit0e191b4ccd6ec8aa22b9d2244a3793daa254bc05 (patch)
tree0752c527ac6862f9062fb5b9241d29085de6b42b /lib
parent68f568d9dc53975c44ab00cf320fa6407146d1e3 (diff)
downloadgitlab-ce-0e191b4ccd6ec8aa22b9d2244a3793daa254bc05.tar.gz
Allow users to disable SSL verification if not connecting to github.com
Diffstat (limited to 'lib')
-rw-r--r--lib/github/client.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/github/client.rb b/lib/github/client.rb
index 7d77f1a91bc..9c476df7d46 100644
--- a/lib/github/client.rb
+++ b/lib/github/client.rb
@@ -10,6 +10,7 @@ module Github
faraday.options.timeout = options.fetch(:timeout, TIMEOUT)
faraday.authorization 'token', options.fetch(:token)
faraday.adapter :net_http
+ faraday.ssl.verify = verify_ssl
end
@rate_limit = RateLimit.new(connection)
@@ -29,14 +30,24 @@ module Github
end
def custom_endpoint
- Gitlab.config.omniauth.providers
- .find { |provider| provider.name == 'github' }
- .to_h
- .dig('args', 'client_options', 'site')
+ github_omniauth_provider.dig('args', 'client_options', 'site')
+ end
+
+ def verify_ssl
+ # If there is no config, we're connecting to github.com
+ # and we should verify ssl.
+ github_omniauth_provider.fetch('verify_ssl', true)
end
def github_endpoint
OmniAuth::Strategies::GitHub.default_options[:client_options][:site]
end
+
+ def github_omniauth_provider
+ @github_omniauth_provider ||=
+ Gitlab.config.omniauth.providers
+ .find { |provider| provider.name == 'github' }
+ .to_h
+ end
end
end