Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Configurable Ports for Dashboard and Mailhog #967

@jovermier

Description

@jovermier

Description

feat: configurable ports for Dashboard and Mailhog services

Problem

The Nhost CLI supports custom ports for most services such as Hasura, Auth, and Postgres, but the ports for the Dashboard and Mailhog services are currently hardcoded. This limits the ability of developers to avoid port conflicts or customize their local environment, particularly when running multiple Nhost instances simultaneously.

Solution

This PR adds two new CLI flags and associated support throughout the codebase to allow customization of Dashboard and Mailhog ports:

  • --dashboard-port with env fallback NHOST_DASHBOARD_PORT
  • --mailhog-port with env fallback NHOST_MAILHOG_PORT

Key implementation updates:

  • Introduced new UintFlag definitions for both ports in cmd/dev/up.go.
  • Extended the ExposePorts struct to include Dashboard and Mailhog fields.
  • Updated service creation functions (dashboard, mailhog) to accept the new ports and apply them using the ports() utility.
  • Adjusted getServices() to pass the port values correctly to each respective service.
  • Ensured printInfo() remains consistent and informative with the correct URLs displayed (though it still prints the base HTTP port for Dashboard and Mailhog to preserve the current behavior; further enhancements to output format could be addressed in a future PR).

Notes

  • Default behavior remains unchanged if the new flags are not specified.
  • This brings Dashboard and Mailhog in line with other services for port configurability.
  • Enables better local dev experience with multiple environments or custom tooling.

Example Usage:

nhost up  \
--dashboard-port 3001  \
--mailhog-port 8026

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