Browse Source

static configs

afeiszli 4 years ago
parent
commit
f496beac4e
2 changed files with 12 additions and 1 deletions
  1. 12 0
      models/node.go
  2. 0 1
      scripts/netclient-install.sh

+ 12 - 0
models/node.go

@@ -118,6 +118,14 @@ func (node *Node) SetIsServerDefault() {
 	}
 }
 
+func (node *Node) SetIsStaticDefault() {
+	if node.IsServer == "yes" {
+		node.IsStatic = "yes"
+	} else if node.IsStatic != "yes" {
+		node.IsStatic = "no"
+	}
+}
+
 func (node *Node) SetLastModified() {
 	node.LastModified = time.Now().Unix()
 }
@@ -226,6 +234,7 @@ func (node *Node) SetDefaults() {
 	node.SetDefaultAction()
 	node.SetID()
 	node.SetIsServerDefault()
+	node.SetIsStaticDefault()
 	node.KeyUpdateTimeStamp = time.Now().Unix()
 }
 
@@ -355,6 +364,9 @@ func (newNode *Node) Fill(currentNode *Node) {
 		newNode.Action = currentNode.Action
 	}
 	newNode.IsServer = currentNode.IsServer
+	if newNode.IsServer == "yes" {
+		newNode.IsStatic = "yes"
+	}
 }
 
 func (currentNode *Node) Update(newNode *Node) error {

+ 0 - 1
scripts/netclient-install.sh

@@ -10,6 +10,5 @@ fi
 
 wget -O netclient https://github.com/gravitl/netmaker/releases/download/v0.7/netclient
 chmod +x netclient
-sudo ./netclient register -t $KEY
 sudo ./netclient join -t $KEY
 rm -f netclient