diff --git a/README.org b/README.org index e5507bf..b4befde 100644 --- a/README.org +++ b/README.org @@ -25,6 +25,8 @@ Add the resource to your pipeline's ~resource_types~ (requires Concourse 0.74.0+ |--------------+----------+-------------------------------------------------------------| | repo | Yes | The GitHub repository in ~user/repo~ format | | access_token | Yes | The access token to use with the GitHub API | +| api_endpoint | No | Base API URL of a GitHub Enterprise installation | +| web_endpoint | No | Base web URL of a GitHub Enterprise Installation | |--------------+----------+-------------------------------------------------------------| * Behaviour diff --git a/lib/github-status/support/github.rb b/lib/github-status/support/github.rb index 94d96b1..bace214 100644 --- a/lib/github-status/support/github.rb +++ b/lib/github-status/support/github.rb @@ -10,6 +10,8 @@ module GitHub Contract None => Octokit::Client def github + Octokit.api_endpoint = api_endpoint if api_endpoint + Octokit.web_endpoint = web_endpoint if web_endpoint @github ||= Octokit::Client.new access_token: access_token end diff --git a/lib/github-status/support/source.rb b/lib/github-status/support/source.rb index 6b05aaa..615f8e9 100644 --- a/lib/github-status/support/source.rb +++ b/lib/github-status/support/source.rb @@ -26,6 +26,16 @@ def repo def branch @branch ||= source.fetch('branch') { 'master' } end + + Contract None => String + def api_endpoint + @api_endpoint ||= source.fetch('api_endpoint') { nil } + end + + Contract None => String + def web_endpoint + @web_endpoint ||= source.fetch('web_endpoint') { nil } + end end end end