From 25acff24a7872d4924aa72d1267af97b803bf406 Mon Sep 17 00:00:00 2001 From: Inside4ndroid Date: Wed, 17 Sep 2025 12:00:13 +0100 Subject: [PATCH] fix(server): bind to 0.0.0.0; set BIND_HOST for Docker/runtime to expose port --- Dockerfile | 1 + apiServer.js | 8 ++++++-- docker-compose.yml | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cde74b6..d7fa6d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ ARG VERSION=dev WORKDIR /app ENV NODE_ENV=production \ API_PORT=8787 \ + BIND_HOST=0.0.0.0 \ APP_VERSION=${VERSION} # Create non-root user diff --git a/apiServer.js b/apiServer.js index 07a6711..cfc70e8 100644 --- a/apiServer.js +++ b/apiServer.js @@ -374,8 +374,12 @@ app.get('/api/streams/:provider/:type/:tmdbId', async (req,res) => { }); const PORT = config.port; -const server = app.listen(PORT, () => { - console.log(`TMDB Embed REST API listening on http://localhost:${PORT}`); +const HOST = process.env.BIND_HOST || '0.0.0.0'; +const server = app.listen(PORT, HOST, () => { + console.log(`TMDB Embed REST API listening on http://${HOST}:${PORT}`); + if (HOST !== 'localhost') { + console.log(`Local access (if running on your machine): http://localhost:${PORT}`); + } console.log('Endpoints:'); console.log(' GET /api/health'); console.log(' GET /api/metrics'); diff --git a/docker-compose.yml b/docker-compose.yml index a619d91..a6ec0da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: # Alternative: supply JSON array # - TMDB_API_KEYS=["key1","key2"] - API_PORT=8787 + - BIND_HOST=0.0.0.0 # FebBox cookies (comma separated) if you want Showbox immediately functional - FEBBOX_COOKIES=${FEBBOX_COOKIES:-} ports: