fix(engine-room): URLs corretas para health check de containers externos

- Adiciona getEngineHealthUrl() para resolver URLs dinamicamente
- MetaSet (Superset) usa SUPERSET_HOST ou 'superset' por padrão
- Plus usa PLUS_HOST ou 'localhost' por padrão
- Resolve problema de localhost:8088 falhar para Superset
This commit is contained in:
Jonas Pacheco 2026-04-03 17:40:01 -03:00
parent 80f9352a7e
commit 06fe8af1fb
1 changed files with 17 additions and 1 deletions

View File

@ -89,8 +89,24 @@ const ENGINES: EngineConfig[] = [
},
];
// Helper para obter URL de health check - considera containers externos
function getEngineHealthUrl(engine: EngineConfig): string {
// MetaSet/Superset roda em container separado
if (engine.name === "metaset") {
const supersetHost = process.env.SUPERSET_HOST || "superset";
return `http://${supersetHost}:${engine.port}${engine.healthPath}`;
}
// Plus também roda externamente (quando instalado)
if (engine.name === "plus") {
const plusHost = process.env.PLUS_HOST || "localhost";
return `http://${plusHost}:${engine.port}${engine.healthPath}`;
}
// Padrão: localhost (para compatibilidade)
return `http://localhost:${engine.port}${engine.healthPath}`;
}
async function checkEngineHealth(engine: EngineConfig): Promise<any> {
const url = `http://localhost:${engine.port}${engine.healthPath}`;
const url = getEngineHealthUrl(engine);
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 5000);