         callback err, body, msg
 
   getCurrentBuild = (msg, type, callback) ->
-    url = "http://#{hostname}/httpAuth/app/rest/builds/?locator=buildType:#{type},running:true"
+    url = "#{base_url}/httpAuth/app/rest/builds/?locator=buildType:#{type},running:true"
     msg.http(url)
       .headers(getAuthHeader())
       .get() (err, res, body) ->

# Configuration:
#   HUBOT_TEAMCITY_USERNAME = <user name>
#   HUBOT_TEAMCITY_PASSWORD = <password>
#   HUBOT_TEAMCITY_HOSTNAME = <host : port>
#
# Commands:
#   hubot show me builds - Show status of currently running builds

    return Authorization: "Basic #{new Buffer("#{username}:#{password}").toString("base64")}", Accept: "application/json"

  getBuildType = (msg, type, callback) ->
    url = "#{base_url}/httpAuth/app/rest/buildTypes/#{type}"
    console.log "sending request to #{url}"
    msg.http(url)
      .headers(getAuthHeader())
