Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit e3515e5

Browse files
committed
[FAB-10186] suppress repetitive config WARNs
- move it to initialization of endpoint config Change-Id: I7078e2949b2590cc198501d16deb4220ee1d47e3 Signed-off-by: Sudesh Shetty <sudesh.shetty@securekey.com>
1 parent 2933804 commit e3515e5

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

pkg/fab/channel/transactor.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ func orderersFromChannelCfg(ctx context.Client, cfg fab.ChannelCfg) ([]fab.Order
6363
return nil, err
6464
}
6565
if len(orderers) > 0 {
66-
logger.Warn("Getting orderers from endpoint config channels.orderer is deprecated, use entity matchers to override orderer configuration")
67-
logger.Warn("visit https://github.com/hyperledger/fabric-sdk-go/blob/master/test/fixtures/config/overrides/local_entity_matchers.yaml for samples")
66+
6867
return orderers, nil
6968
}
7069

pkg/fab/endpointconfig.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func ConfigFromBackend(coreBackend ...core.ConfigBackend) (fab.EndpointConfig, e
8989
return nil, errors.WithMessage(err, "cert pool load failed")
9090
}
9191

92+
//print deprecated warning
93+
detectDeprecatedNetworkConfig(config)
94+
9295
return config, nil
9396
}
9497

@@ -1141,3 +1144,21 @@ func setDefault(dataMap map[string]interface{}, key string, defaultVal bool) {
11411144
dataMap[key] = true
11421145
}
11431146
}
1147+
1148+
//detectDeprecatedConfigOptions detects deprecated config options and prints warnings
1149+
// currently detects: if channels.orderers are defined
1150+
func detectDeprecatedNetworkConfig(endpointConfig *EndpointConfig) {
1151+
1152+
if endpointConfig.networkConfig == nil {
1153+
return
1154+
}
1155+
1156+
//detect if channels orderers are mentioned
1157+
for _, v := range endpointConfig.networkConfig.Channels {
1158+
if len(v.Orderers) > 0 {
1159+
logger.Warn("Getting orderers from endpoint config channels.orderer is deprecated, use entity matchers to override orderer configuration")
1160+
logger.Warn("visit https://github.com/hyperledger/fabric-sdk-go/blob/master/test/fixtures/config/overrides/local_entity_matchers.yaml for samples")
1161+
break
1162+
}
1163+
}
1164+
}

0 commit comments

Comments
 (0)