Browse Source

review comments

Matthew R Kasun 2 years ago
parent
commit
13473f4dd7
2 changed files with 5 additions and 4 deletions
  1. 3 4
      migrate/migrate.go
  2. 2 0
      models/enrollment_key.go

+ 3 - 4
migrate/migrate.go

@@ -8,6 +8,7 @@ import (
 	"github.com/gravitl/netmaker/models"
 )
 
+// Run - runs all migrations
 func Run() {
 	updateEnrollmentKeys()
 }
@@ -29,11 +30,9 @@ func updateEnrollmentKeys() {
 			logger.Log(2, "migration: updating enrollment key type")
 			if key.Unlimited {
 				key.Type = models.Unlimited
-			}
-			if key.UsesRemaining > 0 {
+			} else if key.UsesRemaining > 0 {
 				key.Type = models.Uses
-			}
-			if !key.Expiration.IsZero() {
+			} else if !key.Expiration.IsZero() {
 				key.Type = models.TimeExpiration
 			}
 		}

+ 2 - 0
models/enrollment_key.go

@@ -11,8 +11,10 @@ const (
 	Unlimited
 )
 
+// KeyType - the type of enrollment key
 type KeyType int
 
+// String - returns the string representation of a KeyType
 func (k KeyType) String() string {
 	return [...]string{"Undefined", "TimeExpiration", "Uses", "Unlimited"}[k]
 }