mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 10:39:40 +02:00
blackbox-exporter can't resolve host.docker.internal on Colima, so probes of host.docker.internal:4000 and :9200 always fail. Instead, add a /health/pelias endpoint on the Hono wrapper that proxies to the Pelias API, and update prometheus.yml to probe the wrapper's proxied health endpoint. Also simplifies the status page friendly_name() now that we don't need to display the host.docker.internal targets. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
753 B
TypeScript
32 lines
753 B
TypeScript
/**
|
|
* App factory — separated from index.ts so tests can import without
|
|
* triggering the production bootstrap.
|
|
*/
|
|
|
|
import { Hono } from 'hono';
|
|
import { cors } from 'hono/cors';
|
|
import type { Config } from './config';
|
|
import { createHealthRoutes } from './routes/health';
|
|
import { createGeocodeRoutes } from './routes/geocode';
|
|
|
|
export function createApp(config: Config): Hono {
|
|
const app = new Hono();
|
|
|
|
app.onError((err, c) => {
|
|
console.error('Unhandled error:', err);
|
|
return c.json({ error: 'internal_error' }, 500);
|
|
});
|
|
|
|
app.use(
|
|
'*',
|
|
cors({
|
|
origin: config.cors.origins,
|
|
credentials: true,
|
|
})
|
|
);
|
|
|
|
app.route('/health', createHealthRoutes(config));
|
|
app.route('/api/v1/geocode', createGeocodeRoutes(config));
|
|
|
|
return app;
|
|
}
|