github.com/anjalikarhana/fabric@v2.1.1+incompatible/integration/externalbuilders/binary/bin/run (about) 1 #!/bin/bash 2 3 # Copyright IBM Corp. All Rights Reserved. 4 # 5 # SPDX-License-Identifier: Apache-2.0 6 7 set -euo pipefail 8 9 if [ "$#" -ne 2 ]; then 10 >&2 echo "Expected 2 directories got $#" 11 exit 1 12 fi 13 14 OUTPUT=$1 15 ARTIFACTS=$2 16 17 # shellcheck disable=SC2155 18 export CORE_CHAINCODE_ID_NAME="$(jq -r .chaincode_id "$ARTIFACTS/chaincode.json")" 19 export CORE_PEER_TLS_ENABLED="true" 20 export CORE_TLS_CLIENT_CERT_FILE="$ARTIFACTS/client.crt" 21 export CORE_TLS_CLIENT_KEY_FILE="$ARTIFACTS/client.key" 22 export CORE_PEER_TLS_ROOTCERT_FILE="$ARTIFACTS/root.crt" 23 export CORE_PEER_LOCALMSPID="$(jq -r .mspid "$ARTIFACTS/chaincode.json")" 24 25 jq -r .client_cert "$ARTIFACTS/chaincode.json" > "$CORE_TLS_CLIENT_CERT_FILE" 26 jq -r .client_key "$ARTIFACTS/chaincode.json" > "$CORE_TLS_CLIENT_KEY_FILE" 27 jq -r .root_cert "$ARTIFACTS/chaincode.json" > "$CORE_PEER_TLS_ROOTCERT_FILE" 28 29 if [ -z "$(jq -r .client_cert "$ARTIFACTS/chaincode.json")" ]; then 30 export CORE_PEER_TLS_ENABLED="false" 31 fi 32 33 exec "$OUTPUT/chaincode" -peer.address="$(jq -r .peer_address "$ARTIFACTS/chaincode.json")"