hide mainnet networks in prod build

This commit is contained in:
Roman Volosovskyi 2017-10-20 09:15:56 +02:00
parent 576ece4032
commit 7dd0ba21a2
5 changed files with 41 additions and 31 deletions

1
.env
View File

@ -4,3 +4,4 @@ DEBUG_LOGS_ENABLED=1
STUB_STATUS_GO=0 STUB_STATUS_GO=0
NETWORK_SWITCHING=1 NETWORK_SWITCHING=1
ETHEREUM_DEV_CLUSTER=1 ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1

View File

@ -4,3 +4,4 @@ DEBUG_LOGS_ENABLED=1
STUB_STATUS_GO=0 STUB_STATUS_GO=0
NETWORK_SWITCHING=1 NETWORK_SWITCHING=1
ETHEREUM_DEV_CLUSTER=1 ETHEREUM_DEV_CLUSTER=1
MAINNET_NETWORKS_ENABLED=1

View File

@ -4,3 +4,4 @@ DEBUG_LOGS_ENABLED=0
STUB_STATUS_GO=0 STUB_STATUS_GO=0
NETWORK_SWITCHING=0 NETWORK_SWITCHING=0
ETHEREUM_DEV_CLUSTER=0 ETHEREUM_DEV_CLUSTER=0
MAINNET_NETWORKS_ENABLED=0

View File

@ -1,5 +1,6 @@
(ns status-im.constants (ns status-im.constants
(:require [status-im.utils.types :as types])) (:require [status-im.utils.types :as types]
[status-im.utils.config :as config]))
(def ethereum-rpc-url "http://localhost:8545") (def ethereum-rpc-url "http://localhost:8545")
@ -42,8 +43,19 @@
(= testnet-id rinkeby-id) "Rinkeby" (= testnet-id rinkeby-id) "Rinkeby"
:else "Unknown")) :else "Unknown"))
(def default-networks (def mainnet-networks
(transform-config {"mainnet" {:id "mainnet",
:name "Mainnet",
:config {:NetworkId mainnet-id
:DataDir "/ethereum/mainnet"}}
"mainnet_rpc" {:id "mainnet_rpc",
:name "Mainnet with upstream RPC",
:config {:NetworkId mainnet-id
:DataDir "/ethereum/mainnet_rpc"
:UpstreamConfig {:Enabled true
:URL "https://mainnet.infura.io/z6GCTmjdP3FETEJmMBI4"}}}})
(def testnet-networks
{"testnet" {:id "testnet", {"testnet" {:id "testnet",
:name "Ropsten", :name "Ropsten",
:config {:NetworkId ropsten-id :config {:NetworkId ropsten-id
@ -63,17 +75,11 @@
:config {:NetworkId rinkeby-id :config {:NetworkId rinkeby-id
:DataDir "/ethereum/rinkeby_rpc" :DataDir "/ethereum/rinkeby_rpc"
:UpstreamConfig {:Enabled true :UpstreamConfig {:Enabled true
:URL "https://rinkeby.infura.io/z6GCTmjdP3FETEJmMBI4"}}} :URL "https://rinkeby.infura.io/z6GCTmjdP3FETEJmMBI4"}}}})
"mainnet" {:id "mainnet", (def default-networks
:name "Mainnet", (transform-config
:config {:NetworkId mainnet-id (merge testnet-networks
:DataDir "/ethereum/mainnet"}} (when config/mainnet-networks-enabled? mainnet-networks))))
"mainnet_rpc" {:id "mainnet_rpc",
:name "Mainnet with upstream RPC",
:config {:NetworkId mainnet-id
:DataDir "/ethereum/mainnet_rpc"
:UpstreamConfig {:Enabled true
:URL "https://mainnet.infura.io/z6GCTmjdP3FETEJmMBI4 "}}}}))
(def ^:const send-transaction-no-error-code "0") (def ^:const send-transaction-no-error-code "0")
(def ^:const send-transaction-default-error-code "1") (def ^:const send-transaction-default-error-code "1")

View File

@ -21,4 +21,5 @@
(def notifications-wip-enabled? (enabled? (get-config :NOTIFICATIONS_WIP_ENABLED 0))) (def notifications-wip-enabled? (enabled? (get-config :NOTIFICATIONS_WIP_ENABLED 0)))
(def stub-status-go? (enabled? (get-config :STUB_STATUS_GO 0))) (def stub-status-go? (enabled? (get-config :STUB_STATUS_GO 0)))
(def network-switching-enabled? (enabled? (get-config :NETWORK_SWITCHING 0))) (def network-switching-enabled? (enabled? (get-config :NETWORK_SWITCHING 0)))
(def mainnet-networks-enabled? (enabled? (get-config :MAINNET_NETWORKS_ENABLED 0)))