 # Notes:
 #
 # Author:
-#   kevwil
-
+#   kevwil, davidsulpy
 
 host = process.env.HUBOT_RABBITMQ_HOST
+scheme = process.env.HUBOT_RABBITMQ_SCHEME ?= 'http'
 user = process.env.HUBOT_RABBITMQ_USER ?= 'guest'
 pwd = process.env.HUBOT_RABBITMQ_PWD ?= 'guest'
 virt = process.env.HUBOT_RABBITMQ_VIRT_HOST ?= '%2F'

  robot.respond /rabbit slow queues/i, (msg) ->
    results = []
    msg
      .http("http://#{host}/api/queues")
      .query(sort_reverse: 'messages')
      .headers(Authorization: auth, Accept: 'application/json')
      .get() (err, res, body) ->

  robot.respond /rabbit vhosts/i, (msg) ->
    results = []
    msg
      .http("#{scheme}://#{host}/api/vhosts")
      .headers(Authorization: auth, Accept: 'application/json')
      .get() (err, res, body) ->
        if err
