From b0a0b1d4e477208172056cea52371a0dc51d0007 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 22 Sep 2022 19:08:24 +0200 Subject: [PATCH] chore(dev): add STATUS_PORT env var forwarding to status-go --- Makefile | 2 +- src/app_service/common/network_constants.nim | 2 -- src/app_service/service/accounts/service.nim | 9 +++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1ffb5b43f2..0440a80826 100644 --- a/Makefile +++ b/Makefile @@ -607,7 +607,7 @@ run: $(RUN_TARGET) ICON_TOOL := node_modules/.bin/fileicon -# Currently not in use: https://github.com/status-im/status-desktop/pull/1858 +# Will only work at password login. Keycard login doesn't forward the configuration # STATUS_PORT ?= 30306 run-linux: nim_status_client diff --git a/src/app_service/common/network_constants.nim b/src/app_service/common/network_constants.nim index 8fbf456e03..3ba75da73f 100644 --- a/src/app_service/common/network_constants.nim +++ b/src/app_service/common/network_constants.nim @@ -180,8 +180,6 @@ var NODE_CONFIG* = %* { "EnableNTPSync": true, "KeyStoreDir": "./keystore", "IPFSDir": "./ipfs", - # TODO: commented since it's not necessary (we do the connections thru C bindings). Enable it thru an option once status-nodes are able to be configured in desktop - #"ListenAddr": ":30304", "LogEnabled": true, "LogFile": "geth.log", "LogLevel": $LogLevel.INFO, diff --git a/src/app_service/service/accounts/service.nim b/src/app_service/service/accounts/service.nim index aa3ebcbe44..d36a94943f 100644 --- a/src/app_service/service/accounts/service.nim +++ b/src/app_service/service/accounts/service.nim @@ -284,9 +284,6 @@ proc getDefaultNodeConfig*(self: Service, installationId: string): JsonNode = result["ClusterConfig"]["FilterNodes"] = %* self.fleetConfiguration.getNodes(fleet, FleetNodes.Waku) result["ClusterConfig"]["LightpushNodes"] = %* self.fleetConfiguration.getNodes(fleet, FleetNodes.Waku) - # TODO: commented since it's not necessary (we do the connections thru C bindings). Enable it thru an option once status-nodes are able to be configured in desktop - # result["ListenAddr"] = if existsEnv("STATUS_PORT"): newJString("0.0.0.0:" & $getEnv("STATUS_PORT")) else: newJString("0.0.0.0:30305") - result["KeyStoreDir"] = newJString(self.keyStoreDir.replace(main_constants.STATUSGODIR, "")) proc setLocalAccountSettingsFile(self: Service) = @@ -508,6 +505,10 @@ proc login*(self: Service, account: AccountDto, password: string): string = "OutputMessageCSVEnabled": output_csv } + # Source the connection port from the environment for debugging or if default port not accessible + if existsEnv("STATUS_PORT"): + nodeCfg["ListenAddr"] = newJString("0.0.0.0:" & $getEnv("STATUS_PORT")) + let response = status_account.login(account.name, account.keyUid, hashedPassword, thumbnailImage, largeImage, $nodeCfg) var error = "response doesn't contain \"error\"" @@ -536,7 +537,7 @@ proc loginAccountKeycard*(self: Service, keycardData: KeycardEvent): string = } var settingsJson: JsonNode self.addKeycardDetails(settingsJson, accountDataJson) - + let hashedPassword = hashString(keycardData.keyUid) # using hashed keyUid as password let response = status_account.loginWithKeycard(keycardData.whisperKey.privateKey,