Commit 1be5291a authored by Valery Sizov's avatar Valery Sizov

GHE importer: moved settings login to initializer

parent 1308a8a0
......@@ -261,17 +261,10 @@ production: &base
# - { name: 'gitlab', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
# 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'
# }
# }
# }
# - { name: 'github', app_id: 'YOUR APP ID',
# app_secret: 'YOUR APP SECRET',
# url: "https://github.com/",
# args: { scope: 'user:email' } }
......
......@@ -91,6 +91,24 @@ Settings['omniauth'] ||= Settingslogic.new({})
Settings.omniauth['enabled'] = false if Settings.omniauth['enabled'].nil?
Settings.omniauth['providers'] ||= []
# Fill out omniauth-gitlab settings. It is needed for easy set up GHE or GH by just specifying url.
github_settings = Settings.omniauth['providers'].find{|provider| provider["name"] == "github"}
if github_settings["url"].include?("https://github.com")
github_settings["args"]["client_options"] = {
"site" => 'https://api.github.com/',
"authorize_url" => 'https://github.com/login/oauth/authorize',
"token_url" => 'https://github.com/login/oauth/access_token'
}
else
github_settings["args"]["client_options"] = {
"site" => File.join(github_settings["url"], "api/v3"),
"authorize_url" => File.join(github_settings["url"], "login/oauth/authorize"),
"token_url" => File.join(github_settings["url"], "login/oauth/access_token")
}
end
Settings['issues_tracker'] ||= {}
#
......
......@@ -32,17 +32,10 @@ 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: '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'
}
}
}
- { name: 'github', app_id: 'YOUR APP ID',
app_secret: 'YOUR APP SECRET',
url: "https://github.com/",
args: { scope: 'user:email' } }
```
......@@ -50,17 +43,10 @@ To enable the GitHub OmniAuth provider you must register your application with G
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'
}
}
}
- { name: 'github', app_id: 'YOUR APP ID',
app_secret: 'YOUR APP SECRET',
url: "https://github.example.com/",
args: { scope: 'user:email' } }
```
......
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