diff options
author | Stan Hu <stanhu@gmail.com> | 2016-04-22 12:43:10 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2016-04-26 21:00:55 -0700 |
commit | eede0323453190440a8d738b5eab0723f54dee65 (patch) | |
tree | fd54471c6ed4bf76a0c02404dc3f0918bb3ccdb6 /lib | |
parent | c01ff1f54b55a60f7c7473d0d8a429d5cf9c1609 (diff) | |
download | gitlab-ce-eede0323453190440a8d738b5eab0723f54dee65.tar.gz |
Backport GitHub Enterprise import support from EE
These changes were pulled from GitLab EE to support configuring
an alternative API URL than the default https://api.github.com.
In addition, the `verify_ssl` flag allows users to disable SSL cert
checking.
One modification: add a default `args` option if it does not exist
to avoid breaking existing configurations.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/github_import/client.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/gitlab/github_import/client.rb b/lib/gitlab/github_import/client.rb index 74d1529e1ff..67988ea3460 100644 --- a/lib/gitlab/github_import/client.rb +++ b/lib/gitlab/github_import/client.rb @@ -7,12 +7,19 @@ module Gitlab @client = ::OAuth2::Client.new( config.app_id, config.app_secret, - github_options + github_options.merge(ssl: { verify: config['verify_ssl'] }) ) if access_token ::Octokit.auto_paginate = true - @api = ::Octokit::Client.new(access_token: access_token) + + @api = ::Octokit::Client.new( + access_token: access_token, + api_endpoint: github_options[:site], + connection_options: { + ssl: { verify: config['verify_ssl'] } + } + ) end end @@ -42,11 +49,11 @@ module Gitlab private def config - Gitlab.config.omniauth.providers.find{|provider| provider.name == "github"} + Gitlab.config.omniauth.providers.find { |provider| provider.name == "github" } end def github_options - OmniAuth::Strategies::GitHub.default_options[:client_options].to_h.symbolize_keys + config["args"]["client_options"].deep_symbolize_keys end end end |