Merge branch 'develop' of https://github.com/k4s0/netmaker into develop

This commit is contained in:
lorenzo 2022-09-01 15:49:59 +02:00
commit 55cd13a6a2
2 changed files with 15 additions and 3 deletions

View file

@ -251,7 +251,7 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
var params = mux.Vars(r)
networkName := params["network"]
nodeid := params["nodeid"]
clientid := params["clientid"]
ingressExists := checkIngressExists(nodeid)
if !ingressExists {
err := errors.New("ingress does not exist")
@ -262,9 +262,16 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
}
var extclient models.ExtClient
if clientid != "" {// if clientid is passed from api call, create new extclient with custom clientid instead to generate a random one
extclient.ClientID = clientid
var CustomExtClient models.CustomExtClient
err := json.NewDecoder(r.body).Decode(&CustomExtClient);
if err != nil {
logger.Log(1, "error creating CustomExtClient"+err.Error())
} else {
extclient.ClientID = CustomExtClient.ClientID
}
extclient.Network = networkName
extclient.IngressGatewayID = nodeid
node, err := logic.GetNodeByID(nodeid)

View file

@ -10,6 +10,11 @@ import (
const PLACEHOLDER_KEY_TEXT = "ACCESS_KEY"
const PLACEHOLDER_TOKEN_TEXT = "ACCESS_TOKEN"
// CustomExtClient - struct for CustomExtClient params
type CustomExtClient struct {
ClientID string `json:"clientid"`
}
// AuthParams - struct for auth params
type AuthParams struct {
MacAddress string `json:"macaddress"`