mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-26 03:25:09 +00:00
setAnchorPeer.sh
This commit is contained in:
parent
1986aa44bf
commit
353f4fc13b
1 changed files with 20 additions and 5 deletions
|
|
@ -10,7 +10,7 @@
|
||||||
. scripts/configUpdate.sh
|
. scripts/configUpdate.sh
|
||||||
|
|
||||||
|
|
||||||
# NOTE: this must be run in a CLI container since it requires jq and configtxlator
|
# NOTE: this must be run in a CLI container since it requires jq and configtxlator
|
||||||
createAnchorPeerUpdate() {
|
createAnchorPeerUpdate() {
|
||||||
infoln "Fetching channel config for channel $CHANNEL_NAME"
|
infoln "Fetching channel config for channel $CHANNEL_NAME"
|
||||||
fetchChannelConfig $ORG $CHANNEL_NAME ${CORE_PEER_LOCALMSPID}config.json
|
fetchChannelConfig $ORG $CHANNEL_NAME ${CORE_PEER_LOCALMSPID}config.json
|
||||||
|
|
@ -26,16 +26,31 @@ createAnchorPeerUpdate() {
|
||||||
elif [ $ORG -eq 3 ]; then
|
elif [ $ORG -eq 3 ]; then
|
||||||
HOST="peer0.org3.example.com"
|
HOST="peer0.org3.example.com"
|
||||||
PORT=11051
|
PORT=11051
|
||||||
|
#
|
||||||
|
# 4 5 6
|
||||||
|
#
|
||||||
|
elif [ $ORG -eq 4 ]; then
|
||||||
|
HOST="peer0.org4.example.com"
|
||||||
|
PORT=13051
|
||||||
|
elif [ $ORG -eq 5 ]; then
|
||||||
|
HOST="peer0.org5.example.com"
|
||||||
|
PORT=15051
|
||||||
|
elif [ $ORG -eq 6 ]; then
|
||||||
|
HOST="peer0.org6.example.com"
|
||||||
|
PORT=17051
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
else
|
else
|
||||||
errorln "Org${ORG} unknown"
|
errorln "Org${ORG} unknown"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
# Modify the configuration to append the anchor peer
|
# Modify the configuration to append the anchor peer
|
||||||
jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "'$HOST'","port": '$PORT'}]},"version": "0"}}' ${CORE_PEER_LOCALMSPID}config.json > ${CORE_PEER_LOCALMSPID}modified_config.json
|
jq '.channel_group.groups.Application.groups.'${CORE_PEER_LOCALMSPID}'.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "'$HOST'","port": '$PORT'}]},"version": "0"}}' ${CORE_PEER_LOCALMSPID}config.json > ${CORE_PEER_LOCALMSPID}modified_config.json
|
||||||
{ set +x; } 2>/dev/null
|
{ set +x; } 2>/dev/null
|
||||||
|
|
||||||
# Compute a config update, based on the differences between
|
# Compute a config update, based on the differences between
|
||||||
# {orgmsp}config.json and {orgmsp}modified_config.json, write
|
# {orgmsp}config.json and {orgmsp}modified_config.json, write
|
||||||
# it as a transaction to {orgmsp}anchors.tx
|
# it as a transaction to {orgmsp}anchors.tx
|
||||||
createConfigUpdate ${CHANNEL_NAME} ${CORE_PEER_LOCALMSPID}config.json ${CORE_PEER_LOCALMSPID}modified_config.json ${CORE_PEER_LOCALMSPID}anchors.tx
|
createConfigUpdate ${CHANNEL_NAME} ${CORE_PEER_LOCALMSPID}config.json ${CORE_PEER_LOCALMSPID}modified_config.json ${CORE_PEER_LOCALMSPID}anchors.tx
|
||||||
|
|
@ -53,6 +68,6 @@ ORG=$1
|
||||||
CHANNEL_NAME=$2
|
CHANNEL_NAME=$2
|
||||||
setGlobalsCLI $ORG
|
setGlobalsCLI $ORG
|
||||||
|
|
||||||
createAnchorPeerUpdate
|
createAnchorPeerUpdate
|
||||||
|
|
||||||
updateAnchorPeer
|
updateAnchorPeer
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue