Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable will never change. In JS, with strings and numbers, you're not storing a reference, you're storing a value. If you wrapped this in an object that would work.

let address = process.env.ADDRESS;

app.get('/', (_, res) => {
res.render('index', { connectionCount, address });
res.render('index', { publicConnectionCount, address });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template views/index.pug depends on this value. So you're breaking that template.

});

app.get('/health', (req, res) => {
Expand Down Expand Up @@ -124,4 +125,4 @@ server.listen(port);
if (!address)
address = `http://${await publicIp.v4()}:${port}`;
logger.info('CrewLink Server started: %s', address);
})();
})();