Skip to content

Commit

Permalink
fix: init() handling of 'undefined' string
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Oct 23, 2023
1 parent 61443e8 commit 7a9e88f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@
//TODO: on app start up we can get the port and ip and public dns. Using config we can define if this app is behind an lb.
// If behind an lb it can create a socket connection to the lb node in order to add node to the lb backend list.


async init() {
const defaults = { clientId: indexeddb.ObjectId().toString(), host: window.location.host }
const keys = ['clientId', 'apikey', 'host', 'user_id', 'balancer']
for (let i = 0; i < keys.length; i++) {
this[keys[i]] = config.get(keys[i]) || defaults[keys[i]] || ''
this[keys[i]] = config.get(keys[i])
if (!this[keys[i]] || this[keys[i]] === 'undefined')
this[keys[i]] = defaults[keys[i]] || ''

config.set(keys[i], this[keys[i]])
}
},
Expand Down

0 comments on commit 7a9e88f

Please sign in to comment.