|
@@ -3,14 +3,12 @@ package servercfg
|
|
|
import (
|
|
|
"errors"
|
|
|
"io"
|
|
|
- "net"
|
|
|
"net/http"
|
|
|
"os"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/gravitl/netmaker/config"
|
|
|
- "github.com/gravitl/netmaker/netclient/ncutils"
|
|
|
)
|
|
|
|
|
|
var Version = "dev"
|
|
@@ -546,15 +544,15 @@ func GetNodeID() string {
|
|
|
if os.Getenv("NODE_ID") != "" {
|
|
|
id = os.Getenv("NODE_ID")
|
|
|
} else if config.Config.Server.NodeID != "" {
|
|
|
- id, err := os.Hostname()
|
|
|
- if err != nil {
|
|
|
- id = ncutils.MakeRandomString(10)
|
|
|
- }
|
|
|
- config.Config.Server.NodeID = id
|
|
|
+ id = config.Config.Server.NodeID
|
|
|
}
|
|
|
return id
|
|
|
}
|
|
|
|
|
|
+func SetNodeID(id string) {
|
|
|
+ config.Config.Server.NodeID = id
|
|
|
+}
|
|
|
+
|
|
|
// GetServerCheckinInterval - gets the server check-in time
|
|
|
func GetServerCheckinInterval() int64 {
|
|
|
var t = int64(5)
|
|
@@ -597,22 +595,6 @@ func GetAzureTenant() string {
|
|
|
return azureTenant
|
|
|
}
|
|
|
|
|
|
-// GetMacAddr - get's mac address
|
|
|
-func getMacAddr() string {
|
|
|
- ifas, err := net.Interfaces()
|
|
|
- if err != nil {
|
|
|
- return ""
|
|
|
- }
|
|
|
- var as []string
|
|
|
- for _, ifa := range ifas {
|
|
|
- a := ifa.HardwareAddr.String()
|
|
|
- if a != "" {
|
|
|
- as = append(as, a)
|
|
|
- }
|
|
|
- }
|
|
|
- return as[0]
|
|
|
-}
|
|
|
-
|
|
|
// GetRce - sees if Rce is enabled, off by default
|
|
|
func GetRce() bool {
|
|
|
return os.Getenv("RCE") == "on" || config.Config.Server.RCE == "on"
|