From 3c33fcd3c4d40dff30f95ee1ed3272b3a1f70685 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 7 Jun 2026 22:40:45 -0400 Subject: [PATCH] Serve API only from master process --- src/main.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 15d346c..d3c93d6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,7 +15,8 @@ async function bootstrap() { return; } - const secure = process.env.API_SECURE?.toLowerCase() === 'true'; + const serveApi = process.env.MASTER !== 'false'; + const secure = serveApi && process.env.API_SECURE?.toLowerCase() === 'true'; const currentDirectory = process.cwd(); const keyPath = path.join(currentDirectory, 'secrets', 'key.pem'); const certPath = path.join(currentDirectory, 'secrets', 'cert.pem'); @@ -57,6 +58,12 @@ async function bootstrap() { // Taproot bitcoinjs.initEccLib(ecc); + if (!serveApi) { + await app.init(); + console.log('Worker process skipping API listener'); + return; + } + await app.listen(process.env.API_PORT, '0.0.0.0', (err, address) => { if (err) { console.error(err);