summaryrefslogtreecommitdiff
path: root/lib/gitlab/github_import/client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/github_import/client.rb')
-rw-r--r--lib/gitlab/github_import/client.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb
index a96e0bc63dd..ba869faa92e 100644
--- a/lib/gitlab/github_import/client.rb
+++ b/lib/gitlab/github_import/client.rb
@@ -8,7 +8,7 @@ module Gitlab
def initialize(access_token, host: nil, api_version: 'v3')
@access_token = access_token
- @host = host
+ @host = host.to_s.sub(%r{/+\z}, '')
@api_version = api_version
if access_token
@@ -16,10 +16,6 @@ module Gitlab
end
end
- def api_endpoint
- host.present? && api_version.present? ? "#{host}/api/#{api_version}" : github_options[:site]
- end
-
def api
@api ||= ::Octokit::Client.new(
access_token: access_token,
@@ -27,7 +23,7 @@ module Gitlab
# If there is no config, we're connecting to github.com and we
# should verify ssl.
connection_options: {
- ssl: { verify: config ? config['verify_ssl'] : false }
+ ssl: { verify: config ? config['verify_ssl'] : true }
}
)
end
@@ -70,6 +66,14 @@ module Gitlab
private
+ def api_endpoint
+ if host.present? && api_version.present?
+ "#{host}/api/#{api_version}"
+ else
+ github_options[:site]
+ end
+ end
+
def config
Gitlab.config.omniauth.providers.find { |provider| provider.name == "github" }
end