mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 16:57:51 +08:00
set ingress gateway endpoint
This commit is contained in:
@@ -313,8 +313,14 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
||||
var extclient models.ExtClient
|
||||
extclient.Network = networkName
|
||||
extclient.IngressGatewayID = macaddress
|
||||
//get extclient from body of request
|
||||
err := json.NewDecoder(r.Body).Decode(&extclient)
|
||||
node, err := functions.GetNodeByMacAddress(networkName, macaddress)
|
||||
if err != nil {
|
||||
returnErrorResponse(w, r, formatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
extclient.IngressGatewayEndpoint = node.Endpoint + ":" + strconv.FormatInt(int64(node.ListenPort), 10)
|
||||
|
||||
err = json.NewDecoder(r.Body).Decode(&extclient)
|
||||
if err != nil && !errors.Is(err, io.EOF) {
|
||||
returnErrorResponse(w, r, formatError(err, "internal"))
|
||||
return
|
||||
|
BIN
models/.extclient.go.swp
Normal file
BIN
models/.extclient.go.swp
Normal file
Binary file not shown.
@@ -41,5 +41,5 @@ type ExtClient struct {
|
||||
Address string `json:"address" bson:"address"`
|
||||
LastModified int64 `json:"lastmodified" bson:"lastmodified"`
|
||||
IngressGatewayID string `json:"ingressgatewayid" bson:"ingressgatewayid"`
|
||||
IngressGatewayEnpoint string `json:"ingressgatewayendpoint" bson:"ingressgatewayendpoint"`
|
||||
IngressGatewayEndpoint string `json:"ingressgatewayendpoint" bson:"ingressgatewayendpoint"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user