mirror of
https://github.com/gravitl/netmaker.git
synced 2025-02-25 00:24:37 +08:00
set ingress gateway endpoint
This commit is contained in:
parent
3996d48380
commit
85af4dd85f
3 changed files with 9 additions and 3 deletions
|
@ -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"`
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue