From bc9f24fa0005156ba54bae3b28fa390388ae1969 Mon Sep 17 00:00:00 2001 From: FieldofClay <7278759+FieldofClay@users.noreply.github.com> Date: Sat, 8 Mar 2025 15:44:01 +1100 Subject: [PATCH] allow configuring listen IP --- README.md | 1 + backend/server.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f16e7c1..cbe2db0 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ | POSTGRES_PASSWORD `REQUIRED` | `null` | `postgres` | Password that will be used in postgres database | | POSTGRES_IP `REQUIRED` | `null` | `jellystat-db` or `192.168.0.5` | Hostname/IP of postgres instance | | POSTGRES_PORT `REQUIRED` | `null` | `5432` | Port Postgres is running on | +| JS_LISTEN_IP | `0.0.0.0`| `0.0.0.0` or `::` | Enable listening on specific IP or `::` for IPv6 | | JWT_SECRET `REQUIRED` | `null` | `my-secret-jwt-key` | JWT Key to be used to encrypt JWT tokens for authentication | | TZ `REQUIRED` | `null` | `Etc/UTC` | Server timezone (Can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) | | JS_BASE_URL | `/` | `/` | Base url | diff --git a/backend/server.js b/backend/server.js index ed59fd6..8d4b82a 100644 --- a/backend/server.js +++ b/backend/server.js @@ -53,7 +53,7 @@ const ensureSlashes = (url) => { }; const PORT = 3000; -const LISTEN_IP = "0.0.0.0"; +const LISTEN_IP = process.env.JS_LISTEN_IP || "0.0.0.0"; const JWT_SECRET = process.env.JWT_SECRET; const BASE_NAME = process.env.JS_BASE_URL ? ensureSlashes(process.env.JS_BASE_URL) : ""; @@ -239,7 +239,7 @@ try { setupWebSocketServer(server, BASE_NAME); server.listen(PORT, LISTEN_IP, async () => { - console.log(`[JELLYSTAT] Server listening on http://127.0.0.1:${PORT}`); + console.log(`[JELLYSTAT] Server listening on http://${LISTEN_IP}:${PORT}`); ActivityMonitor.ActivityMonitor(1000); new TaskManager(); new TaskScheduler();