浏览代码

Merge pull request #810 from gravitl/feature_v0.11.0_efficiency

change env to var
dcarns 3 年之前
父节点
当前提交
c6612f9600
共有 2 个文件被更改,包括 12 次插入4 次删除
  1. 10 2
      servercfg/serverconf.go
  2. 2 2
      serverctl/serverctl.go

+ 10 - 2
servercfg/serverconf.go

@@ -12,7 +12,10 @@ import (
 	"github.com/gravitl/netmaker/config"
 )
 
-var Version = "dev"
+var (
+	Version = "dev"
+	commsID = ""
+)
 
 // SetHost - sets the host ip
 func SetHost() error {
@@ -270,7 +273,12 @@ func GetCommsCIDR() string {
 
 // GetCommsID - gets the grpc port
 func GetCommsID() string {
-	return os.Getenv("COMMS_ID")
+	return commsID
+}
+
+// SetCommsID - sets the commsID
+func SetCommsID(newCommsID string) {
+	commsID = newCommsID
 }
 
 // GetMessageQueueEndpoint - gets the message queue endpoint

+ 2 - 2
serverctl/serverctl.go

@@ -52,11 +52,11 @@ func setCommsID() {
 			logger.FatalLog("something went wrong when configuring comms id")
 		}
 		COMMS_NETID = commsid
-		os.Setenv("COMMS_ID", COMMS_NETID)
+		servercfg.SetCommsID(COMMS_NETID)
 		return
 	}
 	COMMS_NETID = currentid
-	os.Setenv("COMMS_ID", COMMS_NETID)
+	servercfg.SetCommsID(COMMS_NETID)
 }
 
 // InitServerNetclient - intializes the server netclient