Skip to content

Follow-up to #245: align runtime port fallbacks in src/server.js with the 4443 config default #477

Description

@melvincarvalho

#245 changed the declared default port from 3000 → 4443 in src/config.js. That PR landed cleanly in April 2026.

But three runtime fallbacks in src/server.js were missed — they still read options.port || 3000, so any code path that reaches createServer() without options.port set (no --port flag and no config loaded) lands on 3000, not 4443:

src/server.js:867:      const port = options.port || 3000;
src/server.js:1209:    const port = options.port || 3000;
src/server.js:1220:export async function startServer(port = 3000, host = '0.0.0.0') {

This creates a real inconsistency: a user who reads src/config.js or docs/configuration.md sees 4443, but in some startup paths (programmatic embedders, tests that call startServer() with no port, certain CLI flag combinations) they get 3000.

Fix

Three one-line changes:

// src/server.js:867 + 1209
const port = options.port || 4443;

// src/server.js:1220
export async function startServer(port = 4443, host = '0.0.0.0') {

Or, more rigorously, import the canonical default from src/config.js:

import { defaults } from './config.js';
// ...
const port = options.port || defaults.port;

The second form is the better long-term shape — one source of truth, future port changes only touch config.js.

Test plan

  • Grep grep -nE "port.*3000|3000.*port" src/ returns nothing (no leftover 3000 fallbacks in the port resolution path)
  • bin/jss.js start with no --port lands on 4443
  • Any existing test that called startServer() with no port arg still passes (or is updated to pin the expected port explicitly)

Cross-references

  • #245 — the change that this follow-up completes
  • #250 — earlier port-related bug that motivated the canonicalization

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions