Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3245730
D6293.id21035.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6293.id21035.diff
View Options
diff --git a/native/app.config.js b/native/app.config.js
--- a/native/app.config.js
+++ b/native/app.config.js
@@ -2,9 +2,25 @@
import ip from 'internal-ip';
+// Finds this machine's hostname in the local network. This is useful for
+// debugging on a real device. The `COMM_DEV` environment variable must be set
+// or this function will return `null`. The `COMM_NAT_DEV_HOSTNAME` environment
+// variable can be used to override the autodetected hostname.
+function getDevHostname() {
+ const { COMM_DEV: isDev, COMM_NAT_DEV_HOSTNAME } = process.env;
+
+ if (!isDev) {
+ return null;
+ }
+ if (COMM_NAT_DEV_HOSTNAME) {
+ return COMM_NAT_DEV_HOSTNAME;
+ }
+ return ip.v4.sync();
+}
+
export default {
extra: {
// developer machine's hostname in the local network
- natDevHostname: ip.v4.sync(),
+ natDevHostname: getDevHostname(),
},
};
diff --git a/native/package.json b/native/package.json
--- a/native/package.json
+++ b/native/package.json
@@ -11,7 +11,7 @@
"clean-ios": "rm -rf ios/Pods/",
"clean-all": "yarn clean && rm -rf ~/Library/Developer/Xcode/DerivedData/Comm-*; cd android && (./gradlew clean || true)",
"postinstall": "bash ./postinstall.sh",
- "start": "yarn expo start --dev-client",
+ "start": "COMM_DEV=1 yarn expo start --dev-client",
"dev": "yarn start",
"test": "yarn jest",
"logfirebase": "adb shell logcat | grep -E -i 'FIRMessagingModule|firebase'",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 8:14 PM (19 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2495284
Default Alt Text
D6293.id21035.diff (1 KB)
Attached To
Mode
D6293: [native] Make 'natDevHostname' configurable from env
Attached
Detach File
Event Timeline
Log In to Comment