From a0f707fee2fc93c9d45b4bdd77742526701605df Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Fri, 28 Sep 2018 13:59:44 +0300 Subject: [PATCH] Add port arg to ubuntu-server.js Use the value of REACT_SERVER_PORT env var if set Change node port and datadir depending on the value of DEV_BUILD config variable Fix missing paren Bugfix Remove desktopJSBundlePath Signed-off-by: Vitaliy Vlasov --- .env | 1 + desktop_files/package.json | 2 +- src/status_im/node/core.cljs | 9 ++++++--- src/status_im/utils/config.cljs | 1 + ubuntu-server.js | 9 ++++++++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 7c861c1fb5..3bb01b58da 100644 --- a/.env +++ b/.env @@ -17,3 +17,4 @@ CACHED_WEBVIEWS_ENABLED=1 EXTENSIONS=1 HARDWALLET_ENABLED=0 PFS_ENCRYPTION_ENABLED=0 +DEV_BUILD=1 diff --git a/desktop_files/package.json b/desktop_files/package.json index 721f85ab37..07acbb6291 100644 --- a/desktop_files/package.json +++ b/desktop_files/package.json @@ -55,7 +55,7 @@ "re-natal": "git+https://github.com/status-im/re-natal.git#master", "react": "16.4.1", "react-dom": "16.4.2", - "react-native": "git+https://github.com/status-im/react-native-desktop.git#fix/text-input-default-value", + "react-native": "git+https://github.com/status-im/react-native-desktop.git#master", "react-native-background-timer": "2.0.0", "react-native-camera": "0.10.0", "react-native-config": "git+https://github.com/status-im/react-native-config.git", diff --git a/src/status_im/node/core.cljs b/src/status_im/node/core.cljs index 8abee55e61..c7846d101b 100644 --- a/src/status_im/node/core.cljs +++ b/src/status_im/node/core.cljs @@ -53,9 +53,12 @@ (get-in db [:accounts/accounts address :network])) (defn- get-base-node-config [config] - (assoc config - :BackupDisabledDataDir (utils.platform/no-backup-directory) - :Name "StatusIM")) + (cond-> (assoc config + :Name "StatusIM" + :BackupDisabledDataDir (utils.platform/no-backup-directory)) + config/dev-build? + (assoc :ListenAddr ":30304" + :DataDir (str (:DataDir config) "_dev")))) (defn- pick-nodes "Picks `limit` different nodes randomly from the list of nodes diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index 39bb45af51..4da89d3a99 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -30,6 +30,7 @@ (def rn-bridge-threshold-warnings-enabled? (enabled? (get-config :RN_BRIDGE_THRESHOLD_WARNINGS 0))) (def extensions-enabled? (enabled? (get-config :EXTENSIONS 0))) (def hardwallet-enabled? (enabled? (get-config :HARDWALLET_ENABLED 0))) +(def dev-build? (enabled? (get-config :DEV_BUILD 0))) ;; CONFIG VALUES (def log-level diff --git a/ubuntu-server.js b/ubuntu-server.js index d4b18aa8ca..c7b3ba4228 100755 --- a/ubuntu-server.js +++ b/ubuntu-server.js @@ -118,8 +118,15 @@ if (process.argv.indexOf('--pipe') != -1) { console.log = console.error rnUbuntuServer(process.stdin, process.stdout); } else { + var port = process.env['REACT_SERVER_PORT'] || 5000; + process.argv.forEach((val) => { + if (val.indexOf('--port') != -1) { + port = val.substring(7); + } + }); + var server = net.createServer((sock) => { DEBUG && console.error("-- Connection from RN client"); rnUbuntuServer(sock, sock); - }).listen(5000, function() { console.error("-- Server starting") }); + }).listen(port, function() { console.error("-- Server starting") }); }