mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Share one configured PostgreSQL pool across worker repositories and make API and worker connection budgets explicit. Add privacy-safe aggregate request, query, pool, sync, and outbox telemetry, a loopback-only representative load fixture, bounded worker shutdown, and focused regression and integration coverage. Document the database-wide budget formula and defer pg_stat_statements activation to a reviewed migration and planned restart.
17 lines
672 B
TypeScript
17 lines
672 B
TypeScript
/** Refuse fixture targets outside the local development boundary. */
|
|
export function requireLoopback(url: string, name: string): URL {
|
|
const parsed = new URL(url);
|
|
if (!['127.0.0.1', 'localhost', '::1'].includes(parsed.hostname)) {
|
|
throw new Error(`${name} must resolve to loopback; refusing non-local load`);
|
|
}
|
|
return parsed;
|
|
}
|
|
|
|
export function requireLocalApi(url: string, expectedPort = 3003): URL {
|
|
const parsed = requireLoopback(url, 'SAUCI_LOAD_API_URL');
|
|
if (parsed.protocol !== 'http:' || Number(parsed.port || 80) !== expectedPort) {
|
|
throw new Error(`SAUCI_LOAD_API_URL must be http loopback on port ${expectedPort}`);
|
|
}
|
|
return parsed;
|
|
}
|