Parsing CORE_PEER_DELIVERYCLIENT_ADDRESSOVERRIDES
Description
Unable to correctly change the value of peer.deliveryclient.addressOverrides via global variables (CORE_PEER_DELIVERYCLIENT_ADDRESSOVERRIDES). A panic occurs when attempting to start the peer.
panic: could not unmarshal peer.deliveryclient.addressOverrides: 3 error(s) decoding:
* '[0]' expected a map, got 'string'
* '[1]' expected a map, got 'string'
* '[2]' expected a map, got 'string'
goroutine 1 [running]:
github.com/hyperledger/fabric/core/deliverservice.(*DeliverServiceConfig).loadDeliverServiceConfig(0xc0001c8ff0)
/core/deliverservice/config.go:182 +0x41e
github.com/hyperledger/fabric/core/deliverservice.GlobalConfig(...)
/core/deliverservice/config.go:60
Most likely due to the missing viperutil.YamlStringToStructHook hook in the parameters of the viper.UnmarshalKey function.
https://github.com/hyperledger/fabric/blob/e595f9b519dd8fccb0b493a18a30effa5313f05b/core/deliverservice/config.go#L78
For example, yaml parser for chaincode.externalBuilders works correctly: https://github.com/hyperledger/fabric/blob/e595f9b519dd8fccb0b493a18a30effa5313f05b/core/peer/config.go#L296
Steps to reproduce
- Set global variable
CORE_PEER_DELIVERYCLIENT_ADDRESSOVERRIDES='[{from: orderer0.example.com, to: orderer0.example.net, caCertsFile: /example1.pem}]'. - Start peer.
which version of fabric?
fabric v2.5.14
fixed