Skip to content

Commit 266276b

Browse files
committed
feat(config): add host option for Metro bind address
1 parent f809e04 commit 266276b

4 files changed

Lines changed: 8 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
__default__: patch
3+
---
4+
5+
Add a new host option to rn-harness.config for Metro bind host, replacing HARNESS_METRO_BIND_HOST.

packages/bundler-metro/src/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const getMetroInstance = async (
6666
.use('/status', getStatusMiddleware(projectRoot));
6767

6868
const ready = waitForBundler(reporter, abortSignal);
69-
const metroBindHost = process.env.HARNESS_METRO_BIND_HOST?.trim();
69+
const metroBindHost = harnessConfig.host?.trim();
7070
if (metroBindHost) {
7171
logger.debug(`Binding Metro server to host ${metroBindHost}`);
7272
}

packages/config/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const ConfigSchema = z
2121
.min(1, 'App registry component name is required'),
2222
runners: z.array(RunnerSchema).min(1, 'At least one runner is required'),
2323
defaultRunner: z.string().optional(),
24+
host: z.string().min(1, 'Host is required').optional(),
2425
webSocketPort: z.number().optional().default(3001),
2526
bridgeTimeout: z
2627
.number()

website/src/docs/getting-started/configuration.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ For Expo projects, the `entryPoint` should be set to the path specified in the `
8484
| `appRegistryComponentName` | **Required.** Name of the component registered with AppRegistry. |
8585
| `runners` | **Required.** Array of test runners (at least one required). |
8686
| `defaultRunner` | Default runner to use when none specified. |
87+
| `host` | Hostname or IP address to bind the Metro server to (default: Metro default). |
8788
| `bridgeTimeout` | Bridge timeout in milliseconds (default: `60000`). |
8889
| `bundleStartTimeout` | Bundle start timeout in milliseconds (default: `15000`). |
8990
| `maxAppRestarts` | Maximum number of app restarts when app fails to report ready (default: `2`). |

0 commit comments

Comments
 (0)