MQTT page: expose broker host/port endpoint

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-10-15 10:22:24 +00:00
parent e74308f5e2
commit 384675b3c6

View file

@ -32,6 +32,13 @@ function parseTopics(raw) {
}
export async function mqttClientRoutes(app) {
// GET /settings/api/mqtt-broker — where devices should point (shown on the
// MQTT Clients page). Same host/port the service-client endpoint hands out.
app.get('/mqtt-broker', { preHandler: requireAdmin }, async () => ({
host: MQTT_BROKER_HOST,
port: MQTT_BROKER_PORT,
}))
// GET /settings/api/mqtt-clients
app.get('/mqtt-clients', { preHandler: requireAdmin }, async () => {
const { rows } = await pool.query(`SELECT ${CLIENT_COLS} FROM mqtt_clients ORDER BY created_at DESC`)