Browse Source

added ee check to servercfg

0xdcarns 3 năm trước cách đây
mục cha
commit
830613153e
2 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 1 0
      config/config.go
  2. 6 2
      controllers/server.go

+ 1 - 0
config/config.go

@@ -74,6 +74,7 @@ type ServerConfig struct {
 	BasicAuth             string `yaml:"basic_auth"`
 	LicenseValue          string `yaml:"license_value"`
 	NetmakerAccountID     string `yaml:"netmaker_account_id"`
+	IsEE                  string `yaml:"is_ee"`
 }
 
 // SQLConfig - Generic SQL Config

+ 6 - 2
controllers/server.go

@@ -10,6 +10,7 @@ import (
 	"strings"
 
 	"github.com/gorilla/mux"
+	"github.com/gravitl/netmaker/ee"
 	"github.com/gravitl/netmaker/logger"
 	"github.com/gravitl/netmaker/logic"
 	"github.com/gravitl/netmaker/models"
@@ -132,10 +133,13 @@ func getServerInfo(w http.ResponseWriter, r *http.Request) {
 func getConfig(w http.ResponseWriter, r *http.Request) {
 	// Set header
 	w.Header().Set("Content-Type", "application/json")
-
 	// get params
-
 	scfg := servercfg.GetServerConfig()
+	scfg.IsEE = "no"
+	if ee.IsEnterprise() {
+		scfg.IsEE = "yes"
+	}
+
 	json.NewEncoder(w).Encode(scfg)
 	//w.WriteHeader(http.StatusOK)
 }