Fixed syntax errors

This commit is contained in:
Petros Aggelatos 2013-12-17 06:04:53 +00:00 committed by Pablo Carranza Vélez
parent 48c5766f3d
commit c98a274bde
2 changed files with 8 additions and 6 deletions

View File

@ -7,11 +7,15 @@ api = express()
LED_FILE = '/sys/class/leds/led0/brightness' LED_FILE = '/sys/class/leds/led0/brightness'
blink = (ms = 200, callback) -> blink = (ms = 200, callback) ->
fs.writeFileSync(LED_FILE, 1) fs.writeFileSync(LED_FILE, 1)
setTimeout(-> fs.writeFile(LED_FILE, 0, callback), ms) setTimeout(->
fs.writeFile(LED_FILE, 0, callback)
, ms)
api.post('/blink', (req, res) -> api.post('/blink', (req, res) ->
interval = setInterval(blink, 400) interval = setInterval(blink, 400)
setTimeout(-> clearInterval(interval), 5000) setTimeout(->
clearInterval(interval)
, 5000)
res.send(200) res.send(200)
) )

View File

@ -13,15 +13,13 @@ console.log('Supervisor started..')
newUuid = utils.getDeviceUuid() newUuid = utils.getDeviceUuid()
oldUuid = knex('config').select('value').where(key: 'uuid') oldUuid = knex('config').select('value').where(key: 'uuid')
bootstrap = Promise.all([newUuid, oldUuid]).then(([newUuid, [oldUuid]]) -> Promise.all([newUuid, oldUuid]).then(([newUuid, [oldUuid]]) ->
if newUuid is oldUuid if newUuid is oldUuid
return true return true
console.log('New device detected. Bootstrapping..') console.log('New device detected. Bootstrapping..')
return bootstrap(newUuid) return bootstrap(newUuid)
) ).then(->
bootstrap.then(->
console.log('Starting OpenVPN..') console.log('Starting OpenVPN..')
openvpn = spawn('openvpn', ['client.conf'], cwd: '/supervisor/data') openvpn = spawn('openvpn', ['client.conf'], cwd: '/supervisor/data')