mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-13 00:24:31 +08:00
Merge branch 'develop' of https://github.com/k4s0/netmaker into develop
This commit is contained in:
commit
55cd13a6a2
2 changed files with 15 additions and 3 deletions
|
@ -251,7 +251,7 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
||||||
var params = mux.Vars(r)
|
var params = mux.Vars(r)
|
||||||
networkName := params["network"]
|
networkName := params["network"]
|
||||||
nodeid := params["nodeid"]
|
nodeid := params["nodeid"]
|
||||||
clientid := params["clientid"]
|
|
||||||
ingressExists := checkIngressExists(nodeid)
|
ingressExists := checkIngressExists(nodeid)
|
||||||
if !ingressExists {
|
if !ingressExists {
|
||||||
err := errors.New("ingress does not exist")
|
err := errors.New("ingress does not exist")
|
||||||
|
@ -262,9 +262,16 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var extclient models.ExtClient
|
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
|
var CustomExtClient models.CustomExtClient
|
||||||
extclient.ClientID = clientid
|
|
||||||
|
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.Network = networkName
|
||||||
extclient.IngressGatewayID = nodeid
|
extclient.IngressGatewayID = nodeid
|
||||||
node, err := logic.GetNodeByID(nodeid)
|
node, err := logic.GetNodeByID(nodeid)
|
||||||
|
|
|
@ -10,6 +10,11 @@ import (
|
||||||
const PLACEHOLDER_KEY_TEXT = "ACCESS_KEY"
|
const PLACEHOLDER_KEY_TEXT = "ACCESS_KEY"
|
||||||
const PLACEHOLDER_TOKEN_TEXT = "ACCESS_TOKEN"
|
const PLACEHOLDER_TOKEN_TEXT = "ACCESS_TOKEN"
|
||||||
|
|
||||||
|
// CustomExtClient - struct for CustomExtClient params
|
||||||
|
type CustomExtClient struct {
|
||||||
|
ClientID string `json:"clientid"`
|
||||||
|
}
|
||||||
|
|
||||||
// AuthParams - struct for auth params
|
// AuthParams - struct for auth params
|
||||||
type AuthParams struct {
|
type AuthParams struct {
|
||||||
MacAddress string `json:"macaddress"`
|
MacAddress string `json:"macaddress"`
|
||||||
|
|
Loading…
Add table
Reference in a new issue