Skip to content

Commit

Permalink
Merge pull request #4 from kasperisager/master
Browse files Browse the repository at this point in the history
Add support for custom GitHub API domains (Enterprise et. al.).
  • Loading branch information
jaredly committed May 12, 2015
2 parents 880b2da + 8ed3f8b commit 8a003f2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lib/handler.js
@@ -1,9 +1,25 @@
var GithubApi = require('github')
var url = require('url')
, GithubApi = require('github')
, debug = require('debug')('strider-github-status')

var GITHUB_DOMAIN = process.env.PLUGIN_GITHUB_API_DOMAIN
, GITHUB_API_ENDPOINT = process.env.PLUGIN_GITHUB_API_ENDPOINT;

var config = {
version: '3.0.0'
};

if (GITHUB_DOMAIN) {
config.host = url.parse(GITHUB_DOMAIN).host;
}

if (GITHUB_API_ENDPOINT) {
config.pathPrefix = url.parse(GITHUB_API_ENDPOINT).path;
}

module.exports = function (token, url, data, status, description) {
debug('Setting status', token, url, data, status, description)
var github = new GithubApi({ version: '3.0.0', })
var github = new GithubApi(config)
github.authenticate({
type: 'oauth',
token: token
Expand Down

0 comments on commit 8a003f2

Please sign in to comment.