Bind server to loopback by default

This commit is contained in:
2026-06-24 15:39:33 +08:00
parent a105228653
commit 285ebd4437
+3 -2
View File
@@ -8,6 +8,7 @@ const { URL } = require('node:url');
const WebSocket = require('ws');
const PORT = Number.parseInt(process.env.PORT || '3000', 10);
const HOST = process.env.HOST || '127.0.0.1';
const TAIL_LINES = Number.parseInt(process.env.TAIL_LINES || '200', 10);
const WATCH_INTERVAL_MS = Number.parseInt(process.env.WATCH_INTERVAL_MS || '500', 10);
const PUBLIC_DIR = path.join(__dirname, 'public');
@@ -269,8 +270,8 @@ async function main() {
queueFileChange(wss, current);
});
server.listen(PORT, () => {
console.log(`Log streamer running at http://localhost:${PORT}`);
server.listen(PORT, HOST, () => {
console.log(`Log streamer running at http://${HOST}:${PORT}`);
console.log(`Streaming ${LOG_FILE}`);
});