Merge pull request #2014 from gravitl/GRA-1161-api_host_endpoint

Gra 1161 api host endpoint
This commit is contained in:
dcarns 2023-02-10 14:57:33 -05:00 committed by GitHub
commit eb2c98d45c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,9 @@
package models
import "net"
import (
"net"
"strings"
)
// ApiHost - the host struct for API usage
type ApiHost struct {
@ -76,7 +79,11 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host {
h.ID = currentHost.ID
h.HostPass = currentHost.HostPass
h.DaemonInstalled = currentHost.DaemonInstalled
if len(a.EndpointIP) == 0 || strings.Contains(a.EndpointIP, "nil") {
h.EndpointIP = currentHost.EndpointIP
} else {
h.EndpointIP = net.ParseIP(a.EndpointIP)
}
h.Debug = a.Debug
h.FirewallInUse = a.FirewallInUse
h.IPForwarding = currentHost.IPForwarding