Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9de15c1e
Commit
9de15c1e
authored
Feb 10, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GHE importer: single configuration for auth and importer
parent
fb638cc8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
20 deletions
+45
-20
config/gitlab.yml.example
config/gitlab.yml.example
+13
-7
doc/integration/github.md
doc/integration/github.md
+30
-3
lib/gitlab/github_import/client.rb
lib/gitlab/github_import/client.rb
+2
-10
No files found.
config/gitlab.yml.example
View file @
9de15c1e
...
...
@@ -258,14 +258,20 @@ production: &base
# args: { access_type: 'offline', approval_prompt: '' } }
# - { name: 'twitter', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET'}
# - { name: 'git
hu
b', app_id: 'YOUR APP ID',
# - { name: 'git
la
b', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
# args: { scope: 'user:email' } }
# Github Enterprise
#- { name: 'github', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
# url: "https://github.example.com/", args: { scope: 'user:email' } }
# args: { scope: 'api' } }
# - { name: 'github', app_id: '01723ee0027dd2b496d9',
# app_secret: '7f4b9298d181375e51cd60e25e9f26603a4dd3cc',
# args: {
# scope: 'user:email',
# client_options: {
# site: 'https://api.github.com/',
# authorize_url: 'https://github.com/login/oauth/authorize',
# token_url: 'https://github.com/login/oauth/access_token'
# }
# }
# }
...
...
doc/integration/github.md
View file @
9de15c1e
...
...
@@ -32,11 +32,38 @@ To enable the GitHub OmniAuth provider you must register your application with G
1.
Under
`providers:`
uncomment (or add) lines that look like the following:
```
- { name: 'github', app_id: 'YOUR APP ID',
app_secret: 'YOUR APP SECRET',
args: { scope: 'user:email' } }
- { name: 'github', app_id: '01723ee0027dd2b496d9',
app_secret: '7f4b9298d181375e51cd60e25e9f26603a4dd3cc',
args: {
scope: 'user:email',
client_options: {
site: 'https://api.github.com/',
authorize_url: 'https://github.com/login/oauth/authorize',
token_url: 'https://github.com/login/oauth/access_token'
}
}
}
```
1.
If you want to use GitHub Enterprise then your configuration should look like the following:
```
- { name: 'github', app_id: 'a4eaa26df2ff35879923',
app_secret: '2f9236c341cf8b3dc86a93652554fccd4ef84c55',
args: {
scope: 'user:email',
client_options: {
site: 'https://github.example.com/api/v3',
authorize_url: 'https://github.example.com/login/oauth/authorize',
token_url: 'https://github.example.com/login/oauth/access_token'
}
}
}
```
1.
Change 'YOUR APP ID' to the client ID from the GitHub application page from step 7.
1.
Change 'YOUR APP SECRET' to the client secret from the GitHub application page from step 7.
...
...
lib/gitlab/github_import/client.rb
View file @
9de15c1e
...
...
@@ -12,7 +12,7 @@ module Gitlab
if
access_token
::
Octokit
.
auto_paginate
=
true
@api
=
::
Octokit
::
Client
.
new
(
access_token:
access_token
,
api_endpoint:
api_endpoint
)
@api
=
::
Octokit
::
Client
.
new
(
access_token:
access_token
,
api_endpoint:
github_options
[
:site
]
)
end
end
...
...
@@ -45,16 +45,8 @@ module Gitlab
Gitlab
.
config
.
omniauth
.
providers
.
find
{
|
provider
|
provider
.
name
==
"github"
}
end
def
api_endpoint
File
.
join
(
config
[
"url"
],
"/api/v3/"
)
if
config
[
"url"
]
end
def
github_options
{
site:
config
[
"url"
]
||
'https://api.github.com'
,
authorize_url:
'/login/oauth/authorize'
,
token_url:
'/login/oauth/access_token'
}
config
[
"args"
][
"client_options"
].
deep_symbolize_keys
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment