mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-01-30 08:03:59 +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
|
||||
|
||||
* 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 = ->
|
||||
# Load config file
|
||||
userConfig = require('/boot/config.json')
|
||||
userConfig.deviceType ?= 'raspberry-pi'
|
||||
|
||||
Promise.try ->
|
||||
fs.readFileAsync('/boot/config.json', 'utf8')
|
||||
.then(JSON.parse)
|
||||
.then (userConfig) ->
|
||||
userConfig.deviceType ?= 'raspberry-pi'
|
||||
if userConfig.uuid? and userConfig.registered_at?
|
||||
return userConfig
|
||||
registerDevice(userConfig.apiKey, userConfig.userId, userConfig.applicationId, userConfig.deviceType, userConfig.uuid)
|
||||
@ -40,7 +40,7 @@ module.exports = ->
|
||||
userConfig.deviceId = device.id
|
||||
fs.writeFileAsync('/boot/config.json', JSON.stringify(userConfig))
|
||||
.return(userConfig)
|
||||
.then ->
|
||||
.then (userConfig) ->
|
||||
console.log('Finishing bootstrapping')
|
||||
Promise.all([
|
||||
knex('config').truncate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user