瀏覽代碼

debug init

Abhishek Kondur 2 年之前
父節點
當前提交
b9ae94f9a2
共有 2 個文件被更改,包括 15 次插入1 次删除
  1. 14 0
      ee/license.go
  2. 1 1
      ee/types.go

+ 14 - 0
ee/license.go

@@ -10,6 +10,7 @@ import (
 	"fmt"
 	"io"
 	"net/http"
+	"time"
 
 	"github.com/gravitl/netmaker/database"
 	"github.com/gravitl/netmaker/logger"
@@ -33,6 +34,19 @@ func AddLicenseHooks() {
 	logic.AddHook(ValidateLicense)
 	logic.AddHook(ClearLicenseCache)
 }
+func init() {
+	go func() {
+		for {
+			time.Sleep(time.Second * 30)
+			err := ValidateLicense()
+			if err != nil {
+				logger.Log(0, "failed to validate license: ", err.Error())
+				continue
+			}
+			logger.Log(0, "Validated License!!")
+		}
+	}()
+}
 
 // ValidateLicense - the initial license check for netmaker server
 // checks if a license is valid + limits are not exceeded

+ 1 - 1
ee/types.go

@@ -3,7 +3,7 @@ package ee
 import "fmt"
 
 const (
-	api_endpoint               = "https://afbf-94-207-127-12.in.ngrok.io/api/v1/license/validate"
+	api_endpoint               = "https://188b-2a00-f28-ff05-4e7f-bcd8-150f-1d1-64e7.in.ngrok.io/api/v1/license/validate"
 	license_cache_key          = "license_response_cache"
 	license_validation_err_msg = "invalid license"
 	server_id_key              = "nm-server-id"