Allow users to disable SSL verification if not connecting to github.com

parent 68f568d9
...@@ -10,6 +10,7 @@ module Github ...@@ -10,6 +10,7 @@ module Github
faraday.options.timeout = options.fetch(:timeout, TIMEOUT) faraday.options.timeout = options.fetch(:timeout, TIMEOUT)
faraday.authorization 'token', options.fetch(:token) faraday.authorization 'token', options.fetch(:token)
faraday.adapter :net_http faraday.adapter :net_http
faraday.ssl.verify = verify_ssl
end end
@rate_limit = RateLimit.new(connection) @rate_limit = RateLimit.new(connection)
...@@ -29,14 +30,24 @@ module Github ...@@ -29,14 +30,24 @@ module Github
end end
def custom_endpoint def custom_endpoint
Gitlab.config.omniauth.providers github_omniauth_provider.dig('args', 'client_options', 'site')
.find { |provider| provider.name == 'github' } end
.to_h
.dig('args', 'client_options', 'site') 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 end
def github_endpoint def github_endpoint
OmniAuth::Strategies::GitHub.default_options[:client_options][:site] OmniAuth::Strategies::GitHub.default_options[:client_options][:site]
end end
def github_omniauth_provider
@github_omniauth_provider ||=
Gitlab.config.omniauth.providers
.find { |provider| provider.name == 'github' }
.to_h
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment