Browse Source

return broker endpoint

Anish Mukherjee 2 years ago
parent
commit
b803e64ee4
1 changed files with 10 additions and 0 deletions
  1. 10 0
      servercfg/serverconf.go

+ 10 - 0
servercfg/serverconf.go

@@ -97,6 +97,7 @@ func GetServerInfo() models.ServerConfig {
 	cfg.CoreDNSAddr = GetCoreDNSAddr()
 	cfg.CoreDNSAddr = GetCoreDNSAddr()
 	cfg.APIPort = GetAPIPort()
 	cfg.APIPort = GetAPIPort()
 	cfg.DNSMode = "off"
 	cfg.DNSMode = "off"
+	cfg.Broker = GetPublicBrokerEndpoint()
 	if IsDNSMode() {
 	if IsDNSMode() {
 		cfg.DNSMode = "on"
 		cfg.DNSMode = "on"
 	}
 	}
@@ -224,6 +225,15 @@ func GetCoreDNSAddr() string {
 	return addr
 	return addr
 }
 }
 
 
+// GetPublicBrokerEndpoint - returns the public broker endpoint which shall be used by netclient
+func GetPublicBrokerEndpoint() string {
+	if os.Getenv("BROKER_ENDPOINT") != "" {
+		return os.Getenv("BROKER_ENDPOINT")
+	} else {
+		return config.Config.Server.BrokerEndpoint
+	}
+}
+
 // GetMessageQueueEndpoint - gets the message queue endpoint
 // GetMessageQueueEndpoint - gets the message queue endpoint
 func GetMessageQueueEndpoint() (string, bool) {
 func GetMessageQueueEndpoint() (string, bool) {
 	host, _ := GetPublicIP()
 	host, _ := GetPublicIP()