mirror of
https://github.com/gravitl/netmaker.git
synced 2024-09-20 15:26:04 +08:00
65faf73fe9
* add api to check if failover node existed * remove 5 minute peerUpdate * update peerUpdate to trigger pull * update Action name to SignalPull * revert the peerUpdate from SignalPull * fix getfailover error issue * rm acls creation for on-prem emqx * remove use of acls * add additional broker status field on status api * NET-1165: Remove creation of acls on emqx (#2996) * rm acls creation for on-prem emqx * remove use of acls * add additional broker status field on status api * comment out mq reconnect logic * configure mq conn params * add metric_interval in ENV for publishing metrics * add metric_interval in ENV for publishing metrics * update PUBLISH_METRIC_INTERVAL env name * revert the mq setttings back * fix error nil issue --------- Co-authored-by: abhishek9686 <abhi281342@gmail.com> Co-authored-by: Abhishek K <32607604+abhishek9686@users.noreply.github.com>
40 lines
919 B
Go
40 lines
919 B
Go
package mq
|
|
|
|
import "github.com/gravitl/netmaker/servercfg"
|
|
|
|
var emqx Emqx
|
|
|
|
type Emqx interface {
|
|
GetType() servercfg.Emqxdeploy
|
|
CreateEmqxUser(username, password string) error
|
|
CreateEmqxUserforServer() error
|
|
CreateEmqxDefaultAuthenticator() error
|
|
CreateEmqxDefaultAuthorizer() error
|
|
CreateDefaultAllowRule() error
|
|
DeleteEmqxUser(username string) error
|
|
}
|
|
|
|
func init() {
|
|
if servercfg.GetBrokerType() != servercfg.EmqxBrokerType {
|
|
return
|
|
}
|
|
if servercfg.GetEmqxDeployType() == servercfg.EmqxCloudDeploy {
|
|
emqx = &EmqxCloud{
|
|
URL: servercfg.GetEmqxRestEndpoint(),
|
|
AppID: servercfg.GetEmqxAppID(),
|
|
AppSecret: servercfg.GetEmqxAppSecret(),
|
|
}
|
|
} else {
|
|
emqx = &EmqxOnPrem{
|
|
URL: servercfg.GetEmqxRestEndpoint(),
|
|
UserName: servercfg.GetMqUserName(),
|
|
Password: servercfg.GetMqPassword(),
|
|
}
|
|
}
|
|
}
|
|
|
|
// GetEmqxHandler - gets emqx handler
|
|
func GetEmqxHandler() Emqx {
|
|
return emqx
|
|
}
|