Skip to content

Commit

Permalink
config: Update githubUser to collection
Browse files Browse the repository at this point in the history
Part of the preparation for #11.
  • Loading branch information
Bland, Mike committed Nov 5, 2017
1 parent 924b6ae commit 52a5a31
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/slack-emoji-issues.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"githubUser": "mbland",
"collection": "mbland",
"githubApiToken": "<github-api-token>",
"slackApiToken": "<slack-api-token>",
"githubTimeout": 5000,
Expand Down
4 changes: 2 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Config(config, updates) {

validate(config)

this.githubUser = config.githubUser
this.collection = config.collection
this.githubApiToken = config.githubApiToken
this.githubTimeout = config.githubTimeout
this.slackApiToken = config.slackApiToken
Expand All @@ -26,7 +26,7 @@ function Config(config, updates) {

var schema = {
requiredTopLevelFields: {
githubUser: 'GitHub organization or username',
collection: 'Organization, username, or project',
githubApiToken: 'GitHub API access token',
githubTimeout: 'GitHub API timeout limit in milliseconds',
slackApiToken: 'Slack API access token',
Expand Down
4 changes: 2 additions & 2 deletions lib/github-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var url = require('url')
module.exports = GitHubClient

function GitHubClient(config) {
this.user = config.githubUser
this.collection = config.collection
this.apiToken = config.githubApiToken
this.timeout = config.githubTimeout
this.baseurl = url.parse(config.githubApiBaseUrl ||
Expand All @@ -27,7 +27,7 @@ function getHttpOptions(client, repository, paramsStr) {
protocol: baseurl.protocol,
host: baseurl.hostname,
port: baseurl.port,
path: baseurl.pathname + 'repos/' + client.user + '/' + repository +
path: baseurl.pathname + 'repos/' + client.collection + '/' + repository +
'/issues',
method: 'POST',
headers: {
Expand Down
2 changes: 1 addition & 1 deletion lib/reaction-issue-filer.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Impl.prototype.fileIssue = function(getReactionsResponse) {

metadata = parseMetadata(getReactionsResponse, this.channel)
this.logger.info(this.msgId, 'filing GitHub issue in ' +
this.githubClient.user + '/' + githubRepository)
this.githubClient.collection + '/' + githubRepository)

return this.githubClient.fileNewIssue(metadata, githubRepository)
.catch(this.abort('failed to create a GitHub issue'))
Expand Down
2 changes: 1 addition & 1 deletion tests/config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Config', function() {

it('should raise errors for missing required fields', function() {
var errors = [
'missing githubUser',
'missing collection',
'missing githubApiToken',
'missing githubTimeout',
'missing slackApiToken',
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test-config-invalid.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"githubUser": "mbland",
"collection": "mbland",
"githubTimeout": 5000,
"slackTimeout": 5000,
"successReaction": "heavy_check_mark"
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"githubUser": "mbland",
"collection": "mbland",
"githubApiToken": "<github-api-token>",
"githubTimeout": 5000,
"slackApiToken": "<slack-api-token>",
Expand Down

0 comments on commit 52a5a31

Please sign in to comment.