set ingress gateway endpoint

This commit is contained in:
afeiszli
2021-05-25 18:05:14 -04:00
parent 3996d48380
commit 85af4dd85f
3 changed files with 9 additions and 3 deletions

View File

@@ -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