From 4cdf4e635ec8362b8971aa6bebd3521118cba3e2 Mon Sep 17 00:00:00 2001
From: "Richard T. Carback III" <rick.carback@gmail.com>
Date: Tue, 13 Jul 2021 23:40:47 +0000
Subject: [PATCH] Add autoselection for betanet and release

---
 basice2e/betanet.txt    |  5 +++++
 basice2e/network.config |  2 ++
 basice2e/release.txt    |  3 +++
 basice2e/run.sh         | 10 +++++++++-
 4 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 basice2e/betanet.txt
 create mode 100644 basice2e/release.txt

diff --git a/basice2e/betanet.txt b/basice2e/betanet.txt
new file mode 100644
index 0000000..afd0c4c
--- /dev/null
+++ b/basice2e/betanet.txt
@@ -0,0 +1,5 @@
+109.169.15.30:22840
+5.12.137.118:22840
+92.246.20.92:22840
+178.16.39.203:22840
+86.135.17.18:22840
diff --git a/basice2e/network.config b/basice2e/network.config
index f51a1dd..42a45df 100644
--- a/basice2e/network.config
+++ b/basice2e/network.config
@@ -3,6 +3,8 @@ localhost:8440
 # when not set via command line, is used to determine to which network
 # the integration test will be run against.
 
+# Note you can also specify "release" and "betanet" on run.sh
+
 # Betanet gateways
 109.169.15.30:22840
 5.12.137.118:22840
diff --git a/basice2e/release.txt b/basice2e/release.txt
new file mode 100644
index 0000000..f0b068d
--- /dev/null
+++ b/basice2e/release.txt
@@ -0,0 +1,3 @@
+34.221.74.216:11420
+52.25.9.28:11420
+54.149.122.115:11420
diff --git a/basice2e/run.sh b/basice2e/run.sh
index eab6ab4..0af1eb2 100755
--- a/basice2e/run.sh
+++ b/basice2e/run.sh
@@ -44,7 +44,15 @@ mkdir -p $GATEWAYLOGS
 mkdir -p $CLIENTOUT
 mkdir -p $CLIENTCLEAN
 
-NETWORKENTRYPOINT=$(head -1 network.config)
+if [ "$NETWORKENTRYPOINT" == "betanet" ]
+then
+    NETWORKENTRYPOINT=$(sort -R betanet.txt | head -1)
+elif [ "$NETWORKENTRYPOINT" == "release" ]
+then
+    NETWORKENTRYPOINT=$(sort -R release.txt | head -1)
+else
+    NETWORKENTRYPOINT=$(head -1 network.config)
+fi
 
 echo "NETWORK: $NETWORKENTRYPOINT"
 
-- 
GitLab