Promisify admin-support
This commit is contained in:
parent
e998e84cca
commit
39f9848ca1
3 changed files with 6 additions and 13 deletions
|
|
@ -340,5 +340,5 @@ function run () {
|
|||
const supportLog = `lamassu-support-server listening on port ${supportPort}`
|
||||
|
||||
webServer.listen(serverPort, () => console.log(serverLog))
|
||||
supportServer.run(supportPort, () => console.log(supportLog))
|
||||
supportServer.run(supportPort).then(console.log(supportLog))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,9 +57,11 @@ app.post('/api/support_logs', (req, res, next) => {
|
|||
.catch(next)
|
||||
})
|
||||
|
||||
function run (port, cb) {
|
||||
const webServer = https.createServer(certOptions, app)
|
||||
webServer.listen(port || 443, cb)
|
||||
function run (port) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const webServer = https.createServer(certOptions, app)
|
||||
webServer.listen(port, resolve)
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = { run }
|
||||
|
|
|
|||
|
|
@ -69,15 +69,6 @@ function update (deviceId, logLines) {
|
|||
* @returns {array} Array of logs for the requested machinej
|
||||
*/
|
||||
function getMachineLogs (deviceId, until = new Date().toISOString()) {
|
||||
const defaults = {
|
||||
logs: [],
|
||||
currentMachine: {
|
||||
name: '',
|
||||
deviceId: ''
|
||||
}
|
||||
}
|
||||
if (!deviceId) return defaults
|
||||
|
||||
const sql = `select id, log_level, timestamp, message from logs
|
||||
where device_id=$1
|
||||
and timestamp <= $3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue