Add healthcheck endpoint

This commit is contained in:
Christopher Cookman 2024-11-11 07:04:41 -07:00
parent fdc05cd165
commit a32f3e09c0
3 changed files with 63 additions and 33 deletions

1
.gitignore vendored
View file

@ -133,3 +133,4 @@ dist
database.db
tts/*
!tts/.gitkeep
tts.json

View file

@ -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);

View file

@ -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 -"
}
]