From e627d005d7c49c2f26c2b6eed23f4ea05c1a7b20 Mon Sep 17 00:00:00 2001 From: Simone Esposito Date: Mon, 21 Dec 2020 13:11:19 +0100 Subject: [PATCH] src/index: Add env var to hardcode current connections This prevents the data from being exposed, handy for self-hosted servers. --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index ec6cbcc..d246220 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,10 +42,11 @@ app.set('view engine', 'pug') app.use(morgan('combined')) app.use(express.static('offsets')) let connectionCount = 0; +let publicConnectionCount = process.env.PUBLIC_CONNECTION_COUNT || connectionCount; let address = process.env.ADDRESS; app.get('/', (_, res) => { - res.render('index', { connectionCount, address }); + res.render('index', { publicConnectionCount, address }); }); app.get('/health', (req, res) => { @@ -124,4 +125,4 @@ server.listen(port); if (!address) address = `http://${await publicIp.v4()}:${port}`; logger.info('CrewLink Server started: %s', address); -})(); \ No newline at end of file +})();