 Publisher = require './Publisher'
 SimpleAuth = require './SimpleAuth'
 
+PUBLISHER = new Publisher namespace: 'meshblu'
 Device = null #circular dependencies are awesome.
 
 class PublishConfig

        forwardedFor: @forwardedFor
      publishConfig.publish callback

  shouldSend: ({fromUuid, toUuid}, callback) =>
    return callback null, false if _.contains @forwardedFor, toUuid


    @forwardedFor = _.union @forwardedFor, [@uuid]

  publish: (callback) =>
    async.series [@doPublish, @forwardPublishToDevices], callback

  # Private(ish) methods
  doPublish: (callback) =>
    PUBLISHER.publish 'config', @uuid, @config, callback

  fetchDevice: (uuid, callback) =>
    device = new Device {uuid}, {@database}
    device.fetch (error, result) =>
