         lastSaved: false
 
     robot.brain.setAutoSave false
-    robot.brain.resetSaveInterval(600)
-    #robot.brain.resetSaveInterval(10)
+    robot.brain.resetSaveInterval DWEET_AUTOSAVE
 
     getData = ->
         dweet_request robot, '/get/latest/dweet', null, (dweet) ->

                robot.brain.save()
            else if dweet.this is 'failed'
                return robot.logger.error dweet.because

            robot.brain.setAutoSave true
            status.connected = true
            status.lastSaved = dweet.with[0].created

            if dweet.with isnt 404
                content = decodeChildren dweet.with[0].content


DWEET_THING = process.env.DWEET_THING
DWEET_KEY = process.env.DWEET_KEY
DWEET_AUTOSAVE = process.env.DWEET_AUTOSAVE or 1800

toBase64 = (json) ->
    new Buffer(JSON.stringify(json)).toString 'base64'
