From 6e70f4302357e15eac2d39acc24f99073685a2cf Mon Sep 17 00:00:00 2001
From: josh <josh@elixxir.io>
Date: Fri, 8 Apr 2022 15:56:29 -0700
Subject: [PATCH] Output ndf in localnetwork run script

---
 localNetwork/run.sh | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/localNetwork/run.sh b/localNetwork/run.sh
index a41f2f4..827e590 100755
--- a/localNetwork/run.sh
+++ b/localNetwork/run.sh
@@ -120,6 +120,34 @@ echo "\nNetwork rounds have run. You may now attempt to connect."
 sleep 4
 
 
+echo "localhost:8200" > results/startgwserver.txt
+
+echo "Setting up NDF for clients..."
+CMD="openssl s_client -showcerts -connect $(tr -d '[:space:]' < results/startgwserver.txt)"
+echo $CMD
+eval $CMD < /dev/null 2>&1 > "results/startgwcert.bin"
+CMD="cat results/startgwcert.bin | openssl x509 -outform PEM"
+echo $CMD
+eval $CMD > "results/startgwcert.pem"
+head "results/startgwcert.pem"
+
+CLIENTCMD="../bin/client getndf --gwhost $(tr -d '[:space:]' < results/startgwserver.txt) --cert results/startgwcert.pem"
+eval $CLIENTCMD >> results/ndf.json 2>&1 &
+PIDVAL=$!
+echo "$CLIENTCMD -- $PIDVAL"
+wait $PIDVAL
+
+cat results/ndf.json | jq . | head -5
+
+file results/ndf.json
+
+if [ ! -s results/ndf.json ]
+then
+    echo "results/ndf.json is empty, cannot proceed"
+    exit -1
+fi
+
+
 
 
 
-- 
GitLab