mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 10:01:55 +00:00
Fixed syntax errors
This commit is contained in:
parent
48c5766f3d
commit
c98a274bde
@ -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)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user