if emqx, avoid sending mq creds from server to client

This commit is contained in:
abhishek9686 2024-01-26 11:15:18 +05:30
parent b5db86d1a7
commit 8a777205d5
2 changed files with 7 additions and 5 deletions

View file

@ -124,9 +124,6 @@ func pull(w http.ResponseWriter, r *http.Request) {
return
}
serverConf := servercfg.GetServerInfo()
if servercfg.GetBrokerType() == servercfg.EmqxBrokerType {
serverConf.MQUserName = hostID
}
key, keyErr := logic.RetrievePublicTrafficKey()
if keyErr != nil {
logger.Log(0, "error retrieving key:", keyErr.Error())

View file

@ -117,8 +117,13 @@ func GetRacAutoDisable() bool {
func GetServerInfo() models.ServerConfig {
var cfg models.ServerConfig
cfg.Server = GetServer()
cfg.MQUserName = GetMqUserName()
cfg.MQPassword = GetMqPassword()
if GetBrokerType() == EmqxBrokerType {
cfg.MQUserName = "HOST_ID"
cfg.MQPassword = "HOST_PASS"
} else {
cfg.MQUserName = GetMqUserName()
cfg.MQPassword = GetMqPassword()
}
cfg.API = GetAPIConnString()
cfg.CoreDNSAddr = GetCoreDNSAddr()
cfg.APIPort = GetAPIPort()