Add healthcheck endpoint
This commit is contained in:
parent
fdc05cd165
commit
a32f3e09c0
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -133,3 +133,4 @@ dist
|
|||
database.db
|
||||
tts/*
|
||||
!tts/.gitkeep
|
||||
tts.json
|
12
index.js
12
index.js
|
@ -857,5 +857,17 @@ app.ws("/api/v1/websocket/:accountNumber", (ws, req) => {
|
|||
});
|
||||
});
|
||||
|
||||
app.get('/api/healthcheck', (req, res) => {
|
||||
// Check if the bot is logged in and connected to Discord
|
||||
const botHealthy = client.isReady();
|
||||
|
||||
// Respond with the health check status
|
||||
res.json({
|
||||
healthy: botHealthy,
|
||||
botStatus: botHealthy ? 'Bot is connected and healthy' : 'Bot is not connected or has failed',
|
||||
timestamp: new Date(),
|
||||
});
|
||||
});
|
||||
|
||||
startTime = new Date();
|
||||
client.login(process.env.DISCORD_TOKEN);
|
|
@ -0,0 +1,17 @@
|
|||
[
|
||||
{
|
||||
"name": "Piper - Amy (Default)",
|
||||
"value": "0",
|
||||
"command": "piper -m /opt/alarm-monitoring/tts/en_US-amy-medium.onnx -f %s"
|
||||
},
|
||||
{
|
||||
"name": "Flite - OG SecuriNet Voice",
|
||||
"value": "1",
|
||||
"command": "flite -o %s"
|
||||
},
|
||||
{
|
||||
"name": "DECTalk Paul",
|
||||
"value": "2",
|
||||
"command": "/usr/bin/dectalk/say -fo %s -"
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue