Browse Source

adapted node routes further to new id

0xdcarns 3 years ago
parent
commit
0f657b4378
2 changed files with 2 additions and 2 deletions
  1. 1 1
      controllers/node.go
  2. 1 1
      logic/util.go

+ 1 - 1
controllers/node.go

@@ -29,7 +29,7 @@ func nodeHandlers(r *mux.Router) {
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/createingress", securityCheck(false, http.HandlerFunc(createIngressGateway))).Methods("POST")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/createingress", securityCheck(false, http.HandlerFunc(createIngressGateway))).Methods("POST")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/deleteingress", securityCheck(false, http.HandlerFunc(deleteIngressGateway))).Methods("DELETE")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/deleteingress", securityCheck(false, http.HandlerFunc(deleteIngressGateway))).Methods("DELETE")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/approve", authorize(true, "user", http.HandlerFunc(uncordonNode))).Methods("POST")
 	r.HandleFunc("/api/nodes/{network}/{nodeid}/approve", authorize(true, "user", http.HandlerFunc(uncordonNode))).Methods("POST")
-	// r.HandleFunc("/api/nodes/{network}", createNode).Methods("POST")
+	r.HandleFunc("/api/nodes/{network}", createNode).Methods("POST")
 	r.HandleFunc("/api/nodes/adm/{network}/lastmodified", authorize(true, "network", http.HandlerFunc(getLastModified))).Methods("GET")
 	r.HandleFunc("/api/nodes/adm/{network}/lastmodified", authorize(true, "network", http.HandlerFunc(getLastModified))).Methods("GET")
 	r.HandleFunc("/api/nodes/adm/{network}/authenticate", authenticate).Methods("POST")
 	r.HandleFunc("/api/nodes/adm/{network}/authenticate", authenticate).Methods("POST")
 
 

+ 1 - 1
logic/util.go

@@ -105,10 +105,10 @@ func CreateNode(node *models.Node) error {
 		return err
 		return err
 	}
 	}
 
 
+	// TODO: This covers legacy nodes, eventually want to remove legacy check
 	if (node.IsServer != "yes" && (node.ID == "" || strings.Contains(node.ID, "###"))) || (node.IsServer == "yes" && servercfg.GetNodeID() == "") {
 	if (node.IsServer != "yes" && (node.ID == "" || strings.Contains(node.ID, "###"))) || (node.IsServer == "yes" && servercfg.GetNodeID() == "") {
 		node.ID = uuid.NewString()
 		node.ID = uuid.NewString()
 	}
 	}
-	logger.Log(0, "server ID: ", node.ID)
 
 
 	//Create a JWT for the node
 	//Create a JWT for the node
 	tokenString, _ := CreateJWT(node.ID, node.MacAddress, node.Network)
 	tokenString, _ := CreateJWT(node.ID, node.MacAddress, node.Network)