summaryrefslogtreecommitdiff
path: root/lib/gitlab/github_import/client.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-11-08 18:06:03 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2017-11-08 18:06:03 +0100
commit2b886a7815fc6e717e6aabc92380679e1dcaf0ee (patch)
tree8ee677aefd46a6981c8238674525db56872676c8 /lib/gitlab/github_import/client.rb
parent07ab4ad60a894d60ac561f9fdbd641fac90b4acc (diff)
downloadgitlab-ce-2b886a7815fc6e717e6aabc92380679e1dcaf0ee.tar.gz
Restore Enterprise support in the GH importer
This was removed by accident as the old GitHub importer handled this deep down the codebase, making it easy to miss.
Diffstat (limited to 'lib/gitlab/github_import/client.rb')
-rw-r--r--lib/gitlab/github_import/client.rb32
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb
index 844530b1ea7..c1c338487a7 100644
--- a/lib/gitlab/github_import/client.rb
+++ b/lib/gitlab/github_import/client.rb
@@ -38,7 +38,14 @@ module Gitlab
# otherwise hitting the rate limit will result in a thread
# being blocked in a `sleep()` call for up to an hour.
def initialize(token, per_page: 100, parallel: true)
- @octokit = Octokit::Client.new(access_token: token, per_page: per_page)
+ @octokit = Octokit::Client.new(
+ access_token: token,
+ per_page: per_page,
+ api_endpoint: api_endpoint
+ )
+
+ @octokit.connection_options[:ssl] = { verify: verify_ssl }
+
@parallel = parallel
end
@@ -163,8 +170,27 @@ module Gitlab
octokit.rate_limit.resets_in + 5
end
- def respond_to_missing?(method, include_private = false)
- octokit.respond_to?(method, include_private)
+ def api_endpoint
+ custom_api_endpoint || default_api_endpoint
+ end
+
+ def custom_api_endpoint
+ github_omniauth_provider.dig('args', 'client_options', 'site')
+ end
+
+ def default_api_endpoint
+ OmniAuth::Strategies::GitHub.default_options[:client_options][:site]
+ end
+
+ def verify_ssl
+ github_omniauth_provider.fetch('verify_ssl', true)
+ end
+
+ def github_omniauth_provider
+ @github_omniauth_provider ||=
+ Gitlab.config.omniauth.providers
+ .find { |provider| provider.name == 'github' }
+ .to_h
end
def rate_limit_counter