mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-02 17:20:39 +00:00
e8fbadb8d6
Also split out deviceConfig set and get to a separate module to avoid circular dependencies. Change-Type: patch Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
16 lines
452 B
CoffeeScript
16 lines
452 B
CoffeeScript
knex = require './db'
|
|
|
|
exports.set = (conf) ->
|
|
confToUpdate = {}
|
|
confToUpdate.values = JSON.stringify(conf.values) if conf.values?
|
|
confToUpdate.targetValues = JSON.stringify(conf.targetValues) if conf.targetValues?
|
|
knex('deviceConfig').update(confToUpdate)
|
|
|
|
exports.get = ->
|
|
knex('deviceConfig').select()
|
|
.then ([ deviceConfig ]) ->
|
|
return {
|
|
values: JSON.parse(deviceConfig.values)
|
|
targetValues: JSON.parse(deviceConfig.targetValues)
|
|
}
|