Skip to content

Commit

Permalink
Make env variables mandatory for script to work
Browse files Browse the repository at this point in the history
RELEASE_NOTIFICATION_ROOM and FLOWDOCK_ORGANIZATION_NAME
This will force better parity in env var setup between dev and prod
enviroments
  • Loading branch information
kb0rg committed Jul 4, 2019
1 parent b5bf00c commit d9b9cd1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions env-var.list
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ HUBOT_FLOWDOCK_API_TOKEN=$HUBOT_FLOWDOCK_API_TOKEN
ZOOM_API_KEY=$ZOOM_API_KEY
ZOOM_API_SECRET=$ZOOM_API_SECRET
FLOWDOCK_ORGANIZATION_NAME=$FLOWDOCK_ORGANIZATION_NAME
RELEASE_NOTIFICATION_ROOM=$RELEASE_NOTIFICATION_ROOM
15 changes: 15 additions & 0 deletions scripts/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ module.exports = function(robot) {
: process.env["RELEASE_NOTIFICATION_ROOM"]

robot.respond(/suggest ?((?:.|\s)*)$/i, res => {
let fallbackErrorMessage = `Please ask your friendly human robot-tender to look into it.`

if (
!process.env["RELEASE_NOTIFICATION_ROOM"] ||
!process.env["FLOWDOCK_ORGANIZATION_NAME"]
) {
robot.logger.error(
`Missing essential configuration for the suggest command. Check your environment variables for RELEASE_NOTIFICATION_ROOM and FLOWDOCK_ORGANIZATION_NAME.`,
)
res.send(
`Sorry, something isn't set up correctly for this command to work. ${fallbackErrorMessage}`,
)
return
}

try {
let user = res.message.user
let userSuggestion = res.match[1]
Expand Down

0 comments on commit d9b9cd1

Please sign in to comment.