mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-31 00:23:57 +00:00
Don't cache config.json
This commit is contained in:
parent
7bc0a7d869
commit
ab26c6a401
@ -1,3 +1,5 @@
|
|||||||
|
* Stop caching config.json, avoids a race that could cause getting stuck repeatedly trying to register [Page]
|
||||||
|
|
||||||
# v0.0.13
|
# v0.0.13
|
||||||
|
|
||||||
* Bind mount /etc/resolv.conf as ro for application containers and supervisor [Praneeth]
|
* Bind mount /etc/resolv.conf as ro for application containers and supervisor [Praneeth]
|
||||||
|
@ -28,10 +28,10 @@ registerDevice = (apiKey, userId, applicationId, deviceType, uuid) ->
|
|||||||
|
|
||||||
module.exports = ->
|
module.exports = ->
|
||||||
# Load config file
|
# Load config file
|
||||||
userConfig = require('/boot/config.json')
|
fs.readFileAsync('/boot/config.json', 'utf8')
|
||||||
|
.then(JSON.parse)
|
||||||
|
.then (userConfig) ->
|
||||||
userConfig.deviceType ?= 'raspberry-pi'
|
userConfig.deviceType ?= 'raspberry-pi'
|
||||||
|
|
||||||
Promise.try ->
|
|
||||||
if userConfig.uuid? and userConfig.registered_at?
|
if userConfig.uuid? and userConfig.registered_at?
|
||||||
return userConfig
|
return userConfig
|
||||||
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType, userConfig.uuid)
|
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType, userConfig.uuid)
|
||||||
@ -40,7 +40,7 @@ module.exports = ->
|
|||||||
userConfig.deviceId = device.id
|
userConfig.deviceId = device.id
|
||||||
fs.writeFileAsync('/boot/config.json', JSON.stringify(userConfig))
|
fs.writeFileAsync('/boot/config.json', JSON.stringify(userConfig))
|
||||||
.return(userConfig)
|
.return(userConfig)
|
||||||
.then ->
|
.then (userConfig) ->
|
||||||
console.log('Finishing bootstrapping')
|
console.log('Finishing bootstrapping')
|
||||||
Promise.all([
|
Promise.all([
|
||||||
knex('config').truncate()
|
knex('config').truncate()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user