 
 
   getProjects = (msg, callback) ->
-    url = "http://#{hostname}/httpAuth/app/rest/projects"
+    url = "#{base_url}/httpAuth/app/rest/projects"
     msg.http(url)
       .headers(getAuthHeader())
       .get() (err, res, body) ->

module.exports = (robot) ->
  username = process.env.HUBOT_TEAMCITY_USERNAME
  password = process.env.HUBOT_TEAMCITY_PASSWORD
  hostname = process.env.HUBOT_TEAMCITY_HOSTNAME

  buildTypes = []


    if project?
      projectSegment = "/projects/name:#{encodeURIComponent(project)}"

    url = "#{base_url}/httpAuth/app/rest#{projectSegment}/buildTypes/name:#{encodeURIComponent(configuration)}/builds"
    msg.http(url)
      .headers(getAuthHeader())
      .query(locator: ["lookupLimit:5","running:any"].join(","))
