firebase / firebase/firebase-tools

[Emulators] Allow overriding emulator ports via CLI flags

Open
#10,756 1 comment 8 reactions 0 assignees View on GitHub
emulator-suite type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

## Problem

Emulator ports can currently only be configured statically in the `emulators` block of `firebase.json` (or interactively via `firebase init emulators`). There is no way to set or override a port at invocation time.

This is painful in several common scenarios:

- **CI / parallel test runs:** running multiple emulator suites concurrently (e.g. sharded test jobs on one runner) requires generating a distinct `firebase.json` per shard just to change port numbers.
- **Port collisions on developer machines:** when a default port is taken (e.g. macOS AirPlay on 5000, see #3875), the only fix is editing a checked-in config file, which then risks being committed and breaking teammates' setups.

## Proposed solution

Per-emulator port flags on `emulators:start` and `emulators:exec` that override the corresponding `firebase.json` values (falling back to config/defaults when omitted), e.g.:

```
firebase emulators:start \
--firestore-port 8081 \
--auth-port 9098 \
--functions-port 5002 \
--ui-port 4001 \
```

Precedence: CLI flag > `firebase.json` > built-in default.

Contributor guide

Open the contributing guide

Research direction

Start by locating the emulators:start and emulators:exec command definitions and the existing handling of emulator ports from firebase.json. Trace how CLI options are parsed and configuration defaults are applied; done means both commands accept the proposed per-emulator flags with CLI > firebase.json > built-in default precedence.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.