From 04a13fbe4bf4db6c1be4ece13602958a713edb4c Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Thu, 4 Jan 2024 13:33:04 +0200 Subject: [PATCH] support specifying ports as env vars --- lib/index.js | 15 +++++++++------ lib/peer.cjs | 7 ++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/index.js b/lib/index.js index ad8fea6..22a384e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -29,10 +29,13 @@ app.get('/invite', (req, reply) => { reply.view('invite.ejs') }) -app.listen({ port: 3000 }, (err, address) => { - if (err) { - app.log.error(err) - process.exit(1) +app.listen( + { host: '0.0.0.0', port: process.env.HTTP_PORT ?? 3000 }, + (err, address) => { + if (err) { + app.log.error(err) + process.exit(1) + } + startPeer() } - startPeer() -}) +) diff --git a/lib/peer.cjs b/lib/peer.cjs index 3833c3c..67c2d43 100644 --- a/lib/peer.cjs +++ b/lib/peer.cjs @@ -25,7 +25,12 @@ module.exports = function startPeer() { connections: { incoming: { net: [ - { scope: 'public', transform: 'shse', port: 8008, host: '0.0.0.0' }, + { + scope: 'public', + transform: 'shse', + port: process.env.PPPPP_PORT ?? 8008, + host: '0.0.0.0', + }, ], }, outgoing: {