Properly set device name, and set undefined arguments to setConfig as null

This commit is contained in:
Pablo Carranza Velez 2016-10-13 14:22:58 -03:00
parent d011e545c5
commit 7bb3931f2c
3 changed files with 4 additions and 2 deletions

View File

@ -1,3 +1,5 @@
* Properly set device name, and set undefined arguments to setConfig as null [Pablo]
# v2.6.2
* Updated knex to ~0.12.3

View File

@ -594,7 +594,7 @@ application.update = update = (force) ->
.then ({ local, dependent }) ->
proxyvisor.fetchAndSetTargetsForDependentApps(dependent, fetch, apiKey)
.then ->
utils.setConfig('name', deviceName) if local.name != deviceName
utils.setConfig('name', local.name) if local.name != deviceName
.then ->
parseEnvAndFormatRemoteApps(local.apps, uuid, apiKey)
.then (remoteApps) ->

View File

@ -150,7 +150,7 @@ exports.getConfig = getConfig = (key) ->
.then ([ conf ]) ->
return conf?.value
exports.setConfig = (key, value) ->
exports.setConfig = (key, value = null) ->
knex('config').update({ value }).where({ key })
.then (n) ->
knex('config').insert({ key, value }) if n == 0