diff --git a/controller/node.go b/controller/node.go index 7adcf30d5..b7a1f8157 100644 --- a/controller/node.go +++ b/controller/node.go @@ -38,12 +38,24 @@ func PostNode(c *gin.Context) { db := context.Database(c) engine := context.Engine(c) - node := &model.Node{} - err := c.Bind(node) + in := struct { + Addr string `json:"address"` + Arch string `json:"architecture"` + Cert string `json:"cert"` + Key string `json:"key"` + CA string `json:"ca"` + }{} + err := c.Bind(&in) if err != nil { c.AbortWithStatus(http.StatusBadRequest) return } + + node := &model.Node{} + node.Addr = in.Addr + node.Cert = in.Cert + node.Key = in.Key + node.CA = in.CA node.Arch = "linux_amd64" err = model.InsertNode(db, node) diff --git a/static/scripts/nodes.js b/static/scripts/nodes.js index cc059ea75..74b7ec2c4 100644 --- a/static/scripts/nodes.js +++ b/static/scripts/nodes.js @@ -4,8 +4,13 @@ function NodeViewModel() { // handle requests to create a new node. $(".modal-node button").click(function(e) { - var addr = $(".modal-node input").val(); - var node = { address: addr }; + + var node = { + address : $("#addr").val(), + key : $("#key").val(), + cert : $("#cert").val(), + ca : $("#ca").val() + }; $.ajax({ url: "/api/nodes",