Skip to content

Commit

Permalink
Add HEROKU_HOSTNAME config variable.
Browse files Browse the repository at this point in the history
This will allow the HTTP keep alive request to work on Heroku hosts. Heroku
won't allow you to make requests to localhost.
  • Loading branch information
tombell committed Apr 11, 2012
1 parent adfcdd4 commit 8269f5a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -15,11 +15,11 @@
},

"dependencies": {
"coffee-script": "1.2.0",
"coffee-script": "1.3.1",
"optparse": "1.0.3",
"scoped-http-client": "0.9.6",
"log": "1.3.0",
"connect": "2.0.3",
"connect": "2.1.0",
"connect_router": "1.8.6"
},

Expand Down
16 changes: 8 additions & 8 deletions src/robot.coffee
Expand Up @@ -161,7 +161,7 @@ class Robot
#
# Sets up basic authentication if parameters are provided
#
# Returns: nothing.
# Returns nothing.
setupConnect: ->
user = process.env.CONNECT_USER
pass = process.env.CONNECT_PASSWORD
Expand All @@ -170,9 +170,7 @@ class Robot

@connect = Connect()

if user and pass
@connect.use Connect.basicAuth(user, path)

@connect.use Connect.basicAuth(user, path) if user and pass
@connect.use Connect.bodyParser()
@connect.use Connect.router (app) =>

Expand All @@ -195,10 +193,12 @@ class Robot

@connect.listen process.env.PORT || 8080

setInterval =>
HttpClient.create("http://localhost:#{process.env.PORT || 8080}/hubot/ping")
.post() (err, res, bod) =>
@logger.info "Keep alive ping!"
hostname = process.env.HEROKU_HOSTNAME || "localhost:#{process.env.PORT || 8080}/"

setinterval =>
httpclient.create("#{hostname}/hubot/ping")
.post() (err, res, body) =>
@logger.info "keep alive ping!"
, 1200000

# Load the adapter Hubot is going to use.
Expand Down

0 comments on commit 8269f5a

Please sign in to comment.