hubotio / hubot

A customizable life embetterment robot.

Home Page:https://hubotio.github.io/hubot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HUBOT_HTTPD environment variable doesn't allow disabling the server properly

mistydemeo opened this issue · comments

bin/hubot.js allows specifying several options via environment variables and commandline switches: https://github.com/hubotio/hubot/blob/master/bin/hubot.js#L23-L29

Most of these values take arguments, but one, HUBOT_HTTPD, is a boolean. It defaults to true and, when set to false, the Express HTTP server is disabled. However, the logic for setting it is buggy; the variable is assigned the same way as with the others that take arguments, so it effectively assigns enableHttpd to a string or true. This has two problems:

  1. All JavaScript strings except an empty string are truthy, and it's unintuitive that the only meaningful value is HUBOT_HTTPD=.
  2. [falsy value] || true evaluates to true, so regardless of what the user does the result is still the same.

Fixed by #1548