Skip to content

Commit

Permalink
fix: /health return 200 if mqtt is disabled (#500)
Browse files Browse the repository at this point in the history
Fixes #469
  • Loading branch information
robertsLando authored Feb 8, 2021
1 parent 6a9931f commit 8e3a4e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,15 @@ app.get('/health', async function (req, res) {
let zwave = false

if (gw) {
mqtt = gw.mqtt ? gw.mqtt.getStatus().status : false
mqtt = gw.mqtt ? gw.mqtt.getStatus() : false
zwave = gw.zwave ? gw.zwave.getStatus().status : false
}

// if mqtt is disabled, return true. Fixes #469
if (mqtt) {
mqtt = mqtt.status || mqtt.config.disabled
}

const status = mqtt && zwave

res.status(status ? 200 : 500).send(status ? 'Ok' : 'Error')
Expand Down

0 comments on commit 8e3a4e3

Please sign in to comment.