Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

split up host, port, and path

  • Loading branch information...
commit cacdb249c1aefbe22081cf2a75068799d0783087 1 parent 147ab4b
@ryanmoran ryanmoran authored
Showing with 14 additions and 5 deletions.
  1. +14 −5 rabbitmq.coffee
View
19 rabbitmq.coffee
@@ -25,6 +25,7 @@
host = process.env.HUBOT_RABBITMQ_HOST
+port = process.env.HUBOT_RABBITMQ_PORT
user = process.env.HUBOT_RABBITMQ_USER ?= 'guest'
pwd = process.env.HUBOT_RABBITMQ_PWD ?= 'guest'
virt = process.env.HUBOT_RABBITMQ_VIRT_HOST ?= '%2F'
@@ -67,7 +68,7 @@ module.exports = (robot) ->
results = []
msg
.http("http://#{host}")
- .port("55672")
+ .port(port)
.path("/api/nodes")
.headers(Authorization: auth, Accept: 'application/json')
.get() (err, res, body) ->
@@ -84,7 +85,9 @@ module.exports = (robot) ->
robot.respond /rabbit queues/i, (msg) ->
results = []
msg
- .http("http://#{host}/api/queues")
+ .http("http://#{host}")
+ .port(port)
+ .path("/api/queues")
.query(sort_reverse: 'messages')
.headers(Authorization: auth, Accept: 'application/json')
.get() (err, res, body) ->
@@ -105,7 +108,9 @@ module.exports = (robot) ->
robot.respond /rabbit slow queues/i, (msg) ->
results = []
msg
- .http("http://#{host}/api/queues")
+ .http("http://#{host}")
+ .port(port)
+ .path("/api/queues")
.query(sort_reverse: 'messages')
.headers(Authorization: auth, Accept: 'application/json')
.get() (err, res, body) ->
@@ -128,7 +133,9 @@ module.exports = (robot) ->
sub = msg.match[1]
results = []
msg
- .http("http://#{host}/api/queues/#{virt}/#{sub}/bindings")
+ .http("http://#{host}")
+ .port(port)
+ .path("/api/queues/#{virt}/#{sub}/bindings")
.headers(Authorization: auth, Accept: 'application/json')
.get() (err, res, body) ->
if err
@@ -150,7 +157,9 @@ module.exports = (robot) ->
robot.respond /rabbit vhosts/i, (msg) ->
results = []
msg
- .http("http://#{host}/api/vhosts")
+ .http("http://#{host}")
+ .port(port)
+ .path("/api/vhosts")
.headers(Authorization: auth, Accept: 'application/json')
.get() (err, res, body) ->
if err
Please sign in to comment.
Something went wrong with that request. Please try again.