Browse Source

migrate emqx

abhishek9686 1 year ago
parent
commit
0259c87f87
2 changed files with 6 additions and 6 deletions
  1. 4 0
      main.go
  2. 2 6
      migrate/migrate.go

+ 4 - 0
main.go

@@ -48,6 +48,10 @@ func main() {
 	defer stop()
 	var waitGroup sync.WaitGroup
 	startControllers(&waitGroup, ctx) // start the api endpoint and mq and stun
+	if os.Getenv("MIGRATE_EMQX") == "true" {
+		logger.Log(0, "migrating emqx...")
+		migrate.MigrateEmqx()
+	}
 	startHooks()
 	<-ctx.Done()
 	waitGroup.Wait()

+ 2 - 6
migrate/migrate.go

@@ -4,7 +4,6 @@ import (
 	"encoding/json"
 	"fmt"
 	"log"
-	"os"
 
 	"golang.org/x/exp/slog"
 
@@ -24,10 +23,7 @@ func Run() {
 	updateHosts()
 	updateNodes()
 	updateAcls()
-	if os.Getenv("MIGRATE_EMQX") == "true" {
-		logger.Log(0, "migrating emqx...")
-		migrateEmqx()
-	}
+
 }
 
 func assignSuperAdmin() {
@@ -299,7 +295,7 @@ func updateAcls() {
 	}
 }
 
-func migrateEmqx() {
+func MigrateEmqx() {
 
 	// err := mq.SendPullSYN()
 	// if err != nil {