netmaker/ee/util.go
Matthew R. Kasun 38cd4d7700 refactor join
also removes server node
suspect there may be issues with proxy
and UI interactions with nodes
2022-12-20 15:29:09 -05:00

49 lines
932 B
Go

package ee
import (
"encoding/base64"
"github.com/gravitl/netmaker/logic"
)
var isEnterprise bool
// setIsEnterprise - sets server to use enterprise features
func setIsEnterprise() {
isEnterprise = true
logic.SetEEForTelemetry(isEnterprise)
}
// base64encode - base64 encode helper function
func base64encode(input []byte) string {
return base64.StdEncoding.EncodeToString(input)
}
// base64decode - base64 decode helper function
func base64decode(input string) []byte {
bytes, err := base64.StdEncoding.DecodeString(input)
if err != nil {
return nil
}
return bytes
}
func getCurrentServerLimit() (limits LicenseLimits) {
limits.SetDefaults()
nodes, err := logic.GetAllNodes()
if err == nil {
limits.Nodes = len(nodes)
}
clients, err := logic.GetAllExtClients()
if err == nil {
limits.Clients = len(clients)
}
users, err := logic.GetUsers()
if err == nil {
limits.Users = len(users)
}
return
}