HomePhabricator
Diffusion Comm e476fb95a0c7

[native] Make 'natDevHostname' configurable from env

Description

[native] Make 'natDevHostname' configurable from env

Summary:
Resolves concerns raised in ENG-2734 and ENG-2707.

This diff introduces two environment variables, whose are read by Expo start command (yarn dev):

  • COMM_DEV - This one must be set, otherwise natDevHostname will be null. Its purpose is not to embed developer machine IP in production builds.
  • COMM_NAT_DEV_HOSTNAME - This one can be used to overwrite the autodetected IP address - I consider this as a replacement for network.json in special cases we want to have full control over the hostname.

Depends on D6267

Test Plan:
The expo config command below evaluates the app.config.js (and some other Expo defaults), it's used internally when running Metro dev server.

cd native

# should be empty
yarn expo config | grep natDevHostname

# should detect local IP
COMM_DEV=1 yarn expo config | grep natDevHostname

# should resolve to '1.2.3.4'
COMM_DEV=1 COMM_NAT_DEV_HOSTNAME=1.2.3.4 yarn expo config | grep natDevHostname

Reviewers: ashoat, jon, atul

Reviewed By: ashoat

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D6293

Details

Provenance
bartekAuthored on Jan 18 2023, 12:52 AM
Reviewer
ashoat
Differential Revision
D6293: [native] Make 'natDevHostname' configurable from env
Parents
rCOMM91ee903bac9d: [native] Fix server list in Dev tools menu
Branches
Unknown
Tags
Unknown