mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
Serve API only from master process
This commit is contained in:
+8
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user