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);