mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-09 05:16:45 +08:00
Merge pull request #1600 from gravitl/bugfix_v0.16.1_ee_checks
logic.Is_EE --> systemcfg.Is_EE
This commit is contained in:
commit
45850ef4a1
5 changed files with 22 additions and 20 deletions
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/gravitl/netmaker/database"
|
"github.com/gravitl/netmaker/database"
|
||||||
"github.com/gravitl/netmaker/logic"
|
"github.com/gravitl/netmaker/logic"
|
||||||
"github.com/gravitl/netmaker/models"
|
"github.com/gravitl/netmaker/models"
|
||||||
|
"github.com/gravitl/netmaker/servercfg"
|
||||||
)
|
)
|
||||||
|
|
||||||
// limit consts
|
// limit consts
|
||||||
|
@ -22,7 +23,7 @@ func checkFreeTierLimits(limit_choice int, next http.Handler) http.HandlerFunc {
|
||||||
Code: http.StatusUnauthorized, Message: "free tier limits exceeded on networks",
|
Code: http.StatusUnauthorized, Message: "free tier limits exceeded on networks",
|
||||||
}
|
}
|
||||||
|
|
||||||
if logic.Free_Tier && logic.Is_EE { // check that free tier limits not exceeded
|
if logic.Free_Tier && servercfg.Is_EE { // check that free tier limits not exceeded
|
||||||
if limit_choice == networks_l {
|
if limit_choice == networks_l {
|
||||||
currentNetworks, err := logic.GetNetworks()
|
currentNetworks, err := logic.GetNetworks()
|
||||||
if (err != nil && !database.IsEmptyRecord(err)) || len(currentNetworks) >= logic.Networks_Limit {
|
if (err != nil && !database.IsEmptyRecord(err)) || len(currentNetworks) >= logic.Networks_Limit {
|
||||||
|
|
|
@ -90,7 +90,7 @@ func getConfig(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
scfg := servercfg.GetServerConfig()
|
scfg := servercfg.GetServerConfig()
|
||||||
scfg.IsEE = "no"
|
scfg.IsEE = "no"
|
||||||
if logic.Is_EE {
|
if servercfg.Is_EE {
|
||||||
scfg.IsEE = "yes"
|
scfg.IsEE = "yes"
|
||||||
}
|
}
|
||||||
json.NewEncoder(w).Encode(scfg)
|
json.NewEncoder(w).Encode(scfg)
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/gravitl/netmaker/logic/pro"
|
"github.com/gravitl/netmaker/logic/pro"
|
||||||
"github.com/gravitl/netmaker/models"
|
"github.com/gravitl/netmaker/models"
|
||||||
"github.com/gravitl/netmaker/models/promodels"
|
"github.com/gravitl/netmaker/models/promodels"
|
||||||
|
"github.com/gravitl/netmaker/servercfg"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -140,7 +141,7 @@ func CreateUser(user models.User) (models.User, error) {
|
||||||
|
|
||||||
// legacy
|
// legacy
|
||||||
if StringSliceContains(user.Networks, currentNets[i].NetID) {
|
if StringSliceContains(user.Networks, currentNets[i].NetID) {
|
||||||
if !Is_EE {
|
if !servercfg.Is_EE {
|
||||||
newUser.AccessLevel = pro.NET_ADMIN
|
newUser.AccessLevel = pro.NET_ADMIN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ func UpdateNode(client mqtt.Client, msg mqtt.Message) {
|
||||||
|
|
||||||
// UpdateMetrics message Handler -- handles updates from client nodes for metrics
|
// UpdateMetrics message Handler -- handles updates from client nodes for metrics
|
||||||
func UpdateMetrics(client mqtt.Client, msg mqtt.Message) {
|
func UpdateMetrics(client mqtt.Client, msg mqtt.Message) {
|
||||||
if logic.Is_EE {
|
if servercfg.Is_EE {
|
||||||
go func() {
|
go func() {
|
||||||
id, err := getID(msg.Topic())
|
id, err := getID(msg.Topic())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -184,7 +184,7 @@ func ServerStartNotify() error {
|
||||||
|
|
||||||
// function to collect and store metrics for server nodes
|
// function to collect and store metrics for server nodes
|
||||||
func collectServerMetrics(networks []models.Network) {
|
func collectServerMetrics(networks []models.Network) {
|
||||||
if !logic.Is_EE {
|
if !servercfg.Is_EE {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(networks) > 0 {
|
if len(networks) > 0 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue