logic.Is_EE --> systemcfg.Is_EE

This commit is contained in:
Matthew R. Kasun 2022-09-25 07:11:26 -04:00
parent f35429f768
commit 5f7d6ea1ef
5 changed files with 22 additions and 20 deletions

View file

@ -6,6 +6,7 @@ import (
"github.com/gravitl/netmaker/database"
"github.com/gravitl/netmaker/logic"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/servercfg"
)
// 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",
}
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 {
currentNetworks, err := logic.GetNetworks()
if (err != nil && !database.IsEmptyRecord(err)) || len(currentNetworks) >= logic.Networks_Limit {

View file

@ -54,13 +54,13 @@ func allowUsers(next http.Handler) http.HandlerFunc {
//
// Get the server configuration.
//
// Schemes: https
// Schemes: https
//
// Security:
// oauth
// Security:
// oauth
//
// Responses:
// 200: serverConfigResponse
// Responses:
// 200: serverConfigResponse
func getServerInfo(w http.ResponseWriter, r *http.Request) {
// Set header
w.Header().Set("Content-Type", "application/json")
@ -75,13 +75,13 @@ func getServerInfo(w http.ResponseWriter, r *http.Request) {
//
// Get the server configuration.
//
// Schemes: https
// Schemes: https
//
// Security:
// oauth
// Security:
// oauth
//
// Responses:
// 200: serverConfigResponse
// Responses:
// 200: serverConfigResponse
func getConfig(w http.ResponseWriter, r *http.Request) {
// Set header
w.Header().Set("Content-Type", "application/json")
@ -90,7 +90,7 @@ func getConfig(w http.ResponseWriter, r *http.Request) {
scfg := servercfg.GetServerConfig()
scfg.IsEE = "no"
if logic.Is_EE {
if servercfg.Is_EE {
scfg.IsEE = "yes"
}
json.NewEncoder(w).Encode(scfg)
@ -101,13 +101,13 @@ func getConfig(w http.ResponseWriter, r *http.Request) {
//
// Registers a client with the server and return the Certificate Authority and certificate.
//
// Schemes: https
// Schemes: https
//
// Security:
// oauth
// Security:
// oauth
//
// Responses:
// 200: registerResponse
// Responses:
// 200: registerResponse
func register(w http.ResponseWriter, r *http.Request) {
logger.Log(2, "processing registration request")
w.Header().Set("Content-Type", "application/json")

View file

@ -12,6 +12,7 @@ import (
"github.com/gravitl/netmaker/logic/pro"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/models/promodels"
"github.com/gravitl/netmaker/servercfg"
"golang.org/x/crypto/bcrypt"
)
@ -140,7 +141,7 @@ func CreateUser(user models.User) (models.User, error) {
// legacy
if StringSliceContains(user.Networks, currentNets[i].NetID) {
if !Is_EE {
if !servercfg.Is_EE {
newUser.AccessLevel = pro.NET_ADMIN
}
}

View file

@ -98,7 +98,7 @@ func UpdateNode(client mqtt.Client, msg mqtt.Message) {
// UpdateMetrics message Handler -- handles updates from client nodes for metrics
func UpdateMetrics(client mqtt.Client, msg mqtt.Message) {
if logic.Is_EE {
if servercfg.Is_EE {
go func() {
id, err := getID(msg.Topic())
if err != nil {

View file

@ -184,7 +184,7 @@ func ServerStartNotify() error {
// function to collect and store metrics for server nodes
func collectServerMetrics(networks []models.Network) {
if !logic.Is_EE {
if !servercfg.Is_EE {
return
}
if len(networks) > 0 {