   return str
 
 Cavalry = ->
+  @slaveUrl = (slave) ->
+   "http://#{model.slaves[slave].ip}:#{CAVALRY_PORT}"
   @postJSON = (arg, slave, opts, cb) ->
-    url = "http://#{model.slaves[slave].ip}:3000/#{arg}"
+    url = "#{@slaveUrl(slave)}/#{arg}"
     request
       json: opts
       auth:

util = require '../lib/util.coffee'
request = require 'request'
SECRET = process.env.CAVALRYPASS or "testingpass"

parseJSON = (str) ->
  try

      body = parseJSON body
      cb error, body
  @getJSON = (arg, slave, cb) ->
    url = "#{@slaveUrl(slave)}/#{arg}"
    request.get
      url: url
      auth:
