From e644f5cb7d1991869d1dcda27bdf881399137f45 Mon Sep 17 00:00:00 2001 From: Haileyesus Date: Thu, 12 Mar 2026 13:13:30 +0300 Subject: [PATCH] fix: add legacy PORT env fallback for server port configuration --- server/cli.js | 5 +++-- server/routes/taskmaster.js | 2 +- vite.config.js | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/server/cli.js b/server/cli.js index 5aafab0..2c58c9a 100755 --- a/server/cli.js +++ b/server/cli.js @@ -110,7 +110,7 @@ function showStatus() { // Environment variables console.log(`\n${c.info('[INFO]')} Configuration:`); - console.log(` SERVER_PORT: ${c.bright(process.env.SERVER_PORT || '3001')} ${c.dim(process.env.SERVER_PORT ? '' : '(default)')}`); + console.log(` SERVER_PORT: ${c.bright(process.env.SERVER_PORT || process.env.PORT || '3001')} ${c.dim(process.env.SERVER_PORT || process.env.PORT ? '' : '(default)')}`); console.log(` DATABASE_PATH: ${c.dim(process.env.DATABASE_PATH || '(using default location)')}`); console.log(` CLAUDE_CLI_PATH: ${c.dim(process.env.CLAUDE_CLI_PATH || 'claude (default)')}`); console.log(` CONTEXT_WINDOW: ${c.dim(process.env.CONTEXT_WINDOW || '160000 (default)')}`); @@ -134,7 +134,7 @@ function showStatus() { console.log(` ${c.dim('>')} Use ${c.bright('cloudcli --port 8080')} to run on a custom port`); console.log(` ${c.dim('>')} Use ${c.bright('cloudcli --database-path /path/to/db')} for custom database`); console.log(` ${c.dim('>')} Run ${c.bright('cloudcli help')} for all options`); - console.log(` ${c.dim('>')} Access the UI at http://localhost:${process.env.SERVER_PORT || '3001'}\n`); + console.log(` ${c.dim('>')} Access the UI at http://localhost:${process.env.SERVER_PORT || process.env.PORT || '3001'}\n`); } // Show help @@ -170,6 +170,7 @@ Examples: Environment Variables: SERVER_PORT Set server port (default: 3001) + PORT Set server port (default: 3001) (LEGACY) DATABASE_PATH Set custom database location CLAUDE_CLI_PATH Set custom Claude CLI path CONTEXT_WINDOW Set context window size (default: 160000) diff --git a/server/routes/taskmaster.js b/server/routes/taskmaster.js index 1299a39..632d99d 100644 --- a/server/routes/taskmaster.js +++ b/server/routes/taskmaster.js @@ -529,7 +529,7 @@ router.get('/next/:projectName', async (req, res) => { // Fallback to loading tasks and finding next one locally // Use localhost to bypass proxy for internal server-to-server calls - const tasksResponse = await fetch(`http://localhost:${process.env.SERVER_PORT || 3001}/api/taskmaster/tasks/${encodeURIComponent(projectName)}`, { + const tasksResponse = await fetch(`http://localhost:${process.env.SERVER_PORT || process.env.PORT || '3001'}/api/taskmaster/tasks/${encodeURIComponent(projectName)}`, { headers: { 'Authorization': req.headers.authorization } diff --git a/vite.config.js b/vite.config.js index 990925e..88c8e28 100755 --- a/vite.config.js +++ b/vite.config.js @@ -14,7 +14,8 @@ export default defineConfig(({ mode }) => { const host = normalizeLoopbackHost(configuredHost) const proxyHost = getConnectableHost(configuredHost) - const serverPort = env.SERVER_PORT || 3001 + // TODO: Remove support for legacy PORT variables in all locations in a future major release, leaving only SERVER_PORT. + const serverPort = env.SERVER_PORT || env.PORT || 3001 return { plugins: [react()],