diff --git a/Changelog.md b/Changelog.md index fb0fa558..cb204b48 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ # Changelog **latest** +- added github oauth configuration support - added twitter oauth configuration support - added google oauth configuration support - added support for jira issue tracker diff --git a/README.md b/README.md index 95650942..d2f364d5 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ - [OmniAuth Integration](#omniauth-integration) - [Google](#google) - [Twitter](#twitter) + - [GitHub](#github) - [External Issue Trackers](#external-issue-trackers) - [Redmine](#redmine) - [Jira](#jira) @@ -650,6 +651,14 @@ Once you have the API key and secret generated, configure them using the `OAUTH_ For example, if your API key is `xxx` and the API secret key is `yyy`, then adding `-e 'OAUTH_TWITTER_API_KEY=xxx' -e 'OAUTH_TWITTER_APP_SECRET=yyy'` to the docker run command enables support for Twitter OAuth. +#### GitHub + +To enable the GitHub OAuth2 OmniAuth provider you must register your application with GitHub. GitHub will generate a Client ID and secret for you to use. Please refer to the GitLab [documentation](http://doc.gitlab.com/ce/integration/github.html) for the procedure to generate the Client ID and secret with github. + +Once you have the Client ID and secret generated, configure them using the `OAUTH_GITHUB_API_KEY` and `OAUTH_GITHUB_APP_SECRET` environment variables respectively. + +For example, if your Client ID is `xxx` and the Client secret is `yyy`, then adding `-e 'OAUTH_GITHUB_API_KEY=xxx' -e 'OAUTH_GITHUB_APP_SECRET=yyy'` to the docker run command enables support for GitHub OAuth. + ### External Issue Trackers GitLab can be configured to use third party issue trackers such as Redmine and Atlassian Jira. Use of third party issue trackers have to be configured on a per project basis from the project settings page. This means that the GitLab's issue tracker is always the default tracker unless specified otherwise. @@ -725,6 +734,8 @@ Below is the complete list of available options that can be used to customize yo - **OAUTH_GOOGLE_APP_SECRET**: Google App Client Secret. No defaults. - **OAUTH_TWITTER_API_KEY**: Twitter App API key. No defaults. - **OAUTH_TWITTER_APP_SECRET**: Twitter App API secret. No defaults. +- **OAUTH_GITHUB_API_KEY**: GitHub App Client ID. No defaults. +- **OAUTH_GITHUB_APP_SECRET**: GitHub App Client secret. No defaults. - **REDMINE_URL**: Location of the redmine server, e.g. `-e 'REDMINE_URL=https://redmine.example.com'`. No defaults. # Maintenance diff --git a/assets/config/gitlabhq/gitlab.yml b/assets/config/gitlabhq/gitlab.yml index 38d6c5be..256474c5 100644 --- a/assets/config/gitlabhq/gitlab.yml +++ b/assets/config/gitlabhq/gitlab.yml @@ -183,9 +183,9 @@ production: &base args: { access_type: 'offline', approval_prompt: '{{OAUTH_GOOGLE_APPROVAL_PROMPT}}' } } - { name: 'twitter', app_id: '{{OAUTH_TWITTER_API_KEY}}', app_secret: '{{OAUTH_TWITTER_APP_SECRET}}'} - # - { name: 'github', app_id: 'YOUR APP ID', - # app_secret: 'YOUR APP SECRET', - # args: { scope: 'user:email' } } + - { name: 'github', app_id: '{{OAUTH_GITHUB_API_KEY}}', + app_secret: '{{OAUTH_GITHUB_APP_SECRET}}', + args: { scope: '{{OAUTH_GITHUB_SCOPE}}' } } diff --git a/assets/init b/assets/init index 8d784f1e..fcf668da 100755 --- a/assets/init +++ b/assets/init @@ -78,6 +78,9 @@ OAUTH_GOOGLE_APP_SECRET=${OAUTH_GOOGLE_APP_SECRET:-} OAUTH_TWITTER_API_KEY=${OAUTH_TWITTER_API_KEY:-} OAUTH_TWITTER_APP_SECRET=${OAUTH_TWITTER_APP_SECRET:-} +OAUTH_GITHUB_API_KEY=${OAUTH_GITHUB_API_KEY:-} +OAUTH_GITHUB_APP_SECRET=${OAUTH_GITHUB_APP_SECRET:-} + # is a redis container linked? if [ -n "${REDISIO_PORT_6379_TCP_ADDR}" ]; then REDIS_HOST=${REDIS_HOST:-${REDISIO_PORT_6379_TCP_ADDR}} @@ -446,6 +449,18 @@ else sudo -u git -H sed '/{{OAUTH_TWITTER_APP_SECRET}}/d' -i /home/git/gitlab/config/gitlab.yml fi +# github +if [ -n "${OAUTH_GITHUB_API_KEY}" -a -n "${OAUTH_GITHUB_APP_SECRET}" ]; then + OAUTH_ENABLED=true + sudo -u git -H sed 's/{{OAUTH_GITHUB_API_KEY}}/'"${OAUTH_GITHUB_API_KEY}"'/' -i /home/git/gitlab/config/gitlab.yml + sudo -u git -H sed 's/{{OAUTH_GITHUB_APP_SECRET}}/'"${OAUTH_GITHUB_APP_SECRET}"'/' -i /home/git/gitlab/config/gitlab.yml + sudo -u git -H sed 's/{{OAUTH_GITHUB_SCOPE}}/user:email/' -i /home/git/gitlab/config/gitlab.yml +else + sudo -u git -H sed '/{{OAUTH_GITHUB_API_KEY}}/d' -i /home/git/gitlab/config/gitlab.yml + sudo -u git -H sed '/{{OAUTH_GITHUB_APP_SECRET}}/d' -i /home/git/gitlab/config/gitlab.yml + sudo -u git -H sed '/{{OAUTH_GITHUB_SCOPE}}/d' -i /home/git/gitlab/config/gitlab.yml +fi + OAUTH_ENABLED=${OAUTH_ENABLED:-false} sudo -u git -H sed 's/{{OAUTH_ENABLED}}/'"${OAUTH_ENABLED}"'/' -i /home/git/gitlab/config/gitlab.yml