set random id

This commit is contained in:
abhishek9686 2024-04-16 10:50:31 +05:30
parent 35ddb97b98
commit 5ff9289462

View file

@ -8,6 +8,7 @@ import (
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/logic"
"github.com/gravitl/netmaker/servercfg"
"golang.org/x/exp/slog"
)
@ -27,7 +28,7 @@ var mqclient mqtt.Client
func setMqOptions(user, password string, opts *mqtt.ClientOptions) {
broker, _ := servercfg.GetMessageQueueEndpoint()
opts.AddBroker(broker)
opts.ClientID = user
opts.ClientID = logic.RandomString(23)
opts.SetUsername(user)
opts.SetPassword(password)
opts.SetAutoReconnect(true)