gateway-bootstrap-loader.mjs
18 lines 835 B
Raw
sha256:5fd903b11bf9305d9390868bedbeb8eef59970eb3073cf8f0e5b52122062654b Merge 'fix/oauth-routing-startup-order' into 'main' — propo… Human 26 days ago
1 // Fault injection for the isolated gateway process, never used by the application.
2 export async function load(url, context, nextLoad) {
3 const target = process.env.GATEWAY_TEST_MODULE;
4 if (target && url.endsWith(`/hub/gateway/${target}.mjs`)) {
5 if (process.env.GATEWAY_TEST_FAULT === 'import') {
6 throw new Error('Injected gateway module load failure');
7 }
8 if (process.env.GATEWAY_TEST_FAULT === 'factory') {
9 const factory = target === 'agent-credential-routes' ? 'createAgentCredentialRouter' : 'createNativeOAuthRouter';
10 return {
11 format: 'module', shortCircuit: true,
12 source: `export function ${factory}() { throw new Error("Injected router construction failure"); }`,
13 };
14 }
15 await new Promise((resolve) => setTimeout(resolve, 250));
16 }
17 return nextLoad(url, context);
18 }
File History 1 commit
sha256:5fd903b11bf9305d9390868bedbeb8eef59970eb3073cf8f0e5b52122062654b Merge 'fix/oauth-routing-startup-order' into 'main' — propo… Human 26 days ago