From a87721a29ec7b65fa3f9aeeb4b08c5621017a013 Mon Sep 17 00:00:00 2001
From: jbhusson <jonah@elixxir.io>
Date: Sat, 17 Aug 2019 18:59:19 -0400
Subject: [PATCH] Add noTLS flag to overwrite TLS info in NDF

---
 cmd/root.go | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/cmd/root.go b/cmd/root.go
index 671e8aefb..81c70a8cb 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -56,6 +56,7 @@ var skipNDFVerification bool
 var ndfRegistration []string
 var ndfUDB []string
 var ndfPubKey string
+var noTLS bool
 
 // Execute adds all child commands to the root command and sets flags
 // appropriately.  This is called by main.main(). It only needs to
@@ -594,6 +595,9 @@ func init() {
 	rootCmd.PersistentFlags().StringSliceVarP(&keyParams, "keyParams", "",
 		make([]string, 0), "Define key generation parameters. Pass values in comma separated list"+
 			" in the following order: MinKeys,MaxKeys,NumRekeys,TTLScalar,MinNumKeys")
+
+	rootCmd.Flags().BoolVarP(&noTLS, "noTLS", "", false,
+		"Set to ignore TLS")
 }
 
 // initConfig reads in config file and ENV variables if set.
@@ -648,4 +652,14 @@ func overwriteNDF(n *ndf.NetworkDefinition) {
 		globals.Log.WARN.Println("Overwrote UDB values in the " +
 			"NetworkDefinition from the commandline")
 	}
+
+	if noTLS {
+		for i := 0; i < len(n.Nodes); i++ {
+			n.Nodes[i].TlsCertificate = ""
+		}
+		n.Registration.TlsCertificate = ""
+		for i := 0; i < len(n.Gateways); i++ {
+			n.Gateways[i].TlsCertificate = ""
+		}
+	}
 }
-- 
GitLab