set broker address on Init
This commit is contained in:
		| @@ -276,7 +276,6 @@ func (h *httpBroker) Address() string { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (h *httpBroker) Connect() error { | func (h *httpBroker) Connect() error { | ||||||
|  |  | ||||||
| 	h.RLock() | 	h.RLock() | ||||||
| 	if h.running { | 	if h.running { | ||||||
| 		h.RUnlock() | 		h.RUnlock() | ||||||
| @@ -397,6 +396,10 @@ func (h *httpBroker) Init(opts ...Option) error { | |||||||
| 		o(&h.opts) | 		o(&h.opts) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if len(h.opts.Addrs) > 0 && len(h.opts.Addrs[0]) > 0 { | ||||||
|  | 		h.address = h.opts.Addrs[0] | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if len(h.id) == 0 { | 	if len(h.id) == 0 { | ||||||
| 		h.id = "broker-" + uuid.NewUUID().String() | 		h.id = "broker-" + uuid.NewUUID().String() | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user