Skip to content

Commit 43c6fcd

Browse files
author
Don Goodman-Wilson
committedFeb 24, 2016
Fixes for BeepBoop
1 parent fb95843 commit 43c6fcd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed
 

‎index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ if (process.env.MONGOLAB_URI) {
4747
* Are being run as an app or a custom integration? The initialization will differ, depending
4848
*/
4949

50-
if (process.env.TOKEN) {
50+
if (process.env.TOKEN || process.env.SLACK_TOKEN) {
5151
//Treat this as a custom integration
5252
var customIntegration = require('./lib/custom_integrations');
53-
var controller = customIntegration.configure(process.env.PORT, process.env.TOKEN, config, onInstallation);
54-
} else if (process.env.CLIENTID && process.env.CLIENTSECRET) {
53+
var token = (process.env.TOKEN) ? process.env.TOKEN : process.env.SLACK_TOKEN;
54+
var controller = customIntegration.configure(token, config, onInstallation);
55+
} else if (process.env.CLIENTID && process.env.CLIENTSECRET && process.env.PORT) {
5556
//Treat this as an app
5657
var app = require('./lib/apps');
5758
var controller = app.configure(process.env.PORT, process.env.CLIENTID, process.env.CLIENTSECRET, config, onInstallation);
5859
} else {
59-
console.log('Error: Please specify either one of: TOKEN or both CLIENTID and CLIENTSECRET in the environment');
60+
console.log('Error: If this is a custom integration, please specify TOKEN in the environment. If this is an app, please specify CLIENTID, CLIENTSECRET, and PORT in the environment');
6061
process.exit(1);
6162
}
6263

‎lib/custom_integrations.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function die(err) {
1111
}
1212

1313
module.exports = {
14-
configure: function (port, token, config, onInstallation) {
14+
configure: function (token, config, onInstallation) {
1515

1616
var controller = Botkit.slackbot(config);
1717

0 commit comments

Comments
 (0)
Please sign in to comment.