Skip to content

Commit f57b3f4

Browse files
committed
Add option to override gossip endpoint
This commit adds an option to override the endpoint of a peer in the gossip layer to use: define CORE_PEER_GOSSIP_ENDPOINT Signed-off-by: Yacov Manevich <[email protected]> Change-Id: Icd71b0ffea7966fd98961a9645ebb9dd3893ad64
1 parent 7a2afe2 commit f57b3f4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gossip/integration/integration.go

+6
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,21 @@ func newConfig(selfEndpoint string, bootPeers ...string) *gossip.Config {
5858

5959
// NewGossipComponent creates a gossip component that attaches itself to the given gRPC server
6060
func NewGossipComponent(identity []byte, endpoint string, s *grpc.Server, dialOpts []grpc.DialOption, bootPeers ...string) gossip.Gossip {
61+
if overrideEndpoint := viper.GetString("peer.gossip.endpoint"); overrideEndpoint != "" {
62+
endpoint = overrideEndpoint
63+
}
64+
6165
conf := newConfig(endpoint, bootPeers...)
6266
cryptSvc := mcs.NewMessageCryptoService()
6367
secAdv := sa.NewSecurityAdvisor()
68+
6469
if viper.GetBool("peer.gossip.ignoresecurity") {
6570
sec := &secImpl{[]byte(endpoint)}
6671
cryptSvc = sec
6772
secAdv = sec
6873
identity = []byte(endpoint)
6974
}
75+
7076
return gossip.NewGossipService(conf, s, secAdv, cryptSvc, identity, dialOpts...)
7177
}
7278

0 commit comments

Comments
 (0)