Skip to content

Commit

Permalink
split script
Browse files Browse the repository at this point in the history
Signed-off-by: sapthasurendran <[email protected]>
  • Loading branch information
sapthasurendran committed Dec 7, 2021
1 parent fcefc13 commit 6da4874
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions fabric-network/docker-based-syschannel/scripts/configUpdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ fetchChannelConfig() {

infoln "Decoding config block to JSON and isolating config to ${OUTPUT}"
set -x
configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config >"${OUTPUT}"
configtxlator proto_decode --input config_block.pb --type common.Block --output config_block.json
jq .data.data[0].payload.data.config config_block.json > "${OUTPUT}"
{ set +x; } 2>/dev/null
}

Expand All @@ -38,12 +39,12 @@ createConfigUpdate() {
OUTPUT=$4

set -x
configtxlator proto_encode --input "${ORIGINAL}" --type common.Config >original_config.pb
configtxlator proto_encode --input "${MODIFIED}" --type common.Config >modified_config.pb
configtxlator compute_update --channel_id "${CHANNEL}" --original original_config.pb --updated modified_config.pb >config_update.pb
configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate >config_update.json
echo '{"payload":{"header":{"channel_header":{"channel_id":"'$CHANNEL'", "type":2}},"data":{"config_update":'$(cat config_update.json)'}}}' | jq . >config_update_in_envelope.json
configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope >"${OUTPUT}"
configtxlator proto_encode --input "${ORIGINAL}" --type common.Config --output original_config.pb
configtxlator proto_encode --input "${MODIFIED}" --type common.Config --output modified_config.pb
configtxlator compute_update --channel_id "${CHANNEL}" --original original_config.pb --updated modified_config.pb --output config_update.pb
configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json
echo '{"payload":{"header":{"channel_header":{"channel_id":"'$CHANNEL'", "type":2}},"data":{"config_update":'$(cat config_update.json)'}}}' | jq . > config_update_in_envelope.json
configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output "${OUTPUT}"
{ set +x; } 2>/dev/null
}

Expand Down

0 comments on commit 6da4874

Please sign in to comment.