This commit is contained in:
seb
2026-07-07 20:08:23 +02:00
parent 61fee8069d
commit b4fa5857ad
3 changed files with 6 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ for (const [key, value] of Object.entries(process.env)) {
const id = key.substring(9, key.length - 4);
ENDPOINTS.push({
id,
name: process.env[`ENDPOINT_${id}_NAME`] || id,
url: value,
expectJsonAttr: process.env[`ENDPOINT_${id}_EXPECT_JSON_ATTR`],
expectSubstring: process.env[`ENDPOINT_${id}_EXPECT_SUBSTRING`]
@@ -31,7 +32,7 @@ for (const [key, value] of Object.entries(process.env)) {
}
}
if (ENDPOINTS.length === 0) {
ENDPOINTS.push({ id: 'DEFAULT', url: process.env.TSE_URL || 'http://3.78.227.48:20001/' });
ENDPOINTS.push({ id: 'DEFAULT', name: 'Default Endpoint', url: process.env.TSE_URL || 'http://3.78.227.48:20001/' });
}
// ── DB ────────────────────────────────────────────────────────────────────────
@@ -294,7 +295,7 @@ const app = express();
app.use((_, res, next) => { res.setHeader('Access-Control-Allow-Origin', '*'); next(); });
app.get('/api/endpoints', (_, res) => {
res.json(ENDPOINTS.map(e => ({ id: e.id, url: e.url })));
res.json(ENDPOINTS.map(e => ({ id: e.id, name: e.name, url: e.url })));
});
app.get('/api/summary', (req, res) => {