-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen-external-package.sh
25 lines (20 loc) · 876 Bytes
/
gen-external-package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
CHAINCODE_NAME=${1:-"basic"}
ORG=${2:-"org1"}
CHAINCODE_SERVER_PORT=${3:-"7052"}
CHAINCODE_ROOT_DIR=${4:-"./hf_nfs_client/chaincode/${CHAINCODE_NAME}/packaging"}
ADDRESS="${CHAINCODE_NAME}-${ORG}:${CHAINCODE_SERVER_PORT}"
pushd ${CHAINCODE_ROOT_DIR}
echo "{
\"address\": \"${ADDRESS}\",
\"dial_timeout\": \"10s\",
\"tls_required\": false,
\"client_auth_required\": false,
\"client_key\": \"-----BEGIN EC PRIVATE KEY----- ... -----END EC PRIVATE KEY-----\",
\"client_cert\": \"-----BEGIN CERTIFICATE----- ... -----END CERTIFICATE-----\",
\"root_cert\": \"-----BEGIN CERTIFICATE---- ... -----END CERTIFICATE-----\"
}" > connection.json
tar cfz code.tar.gz connection.json
echo "{\"path\":\"\",\"type\":\"external\",\"label\":\"${CHAINCODE_NAME}\"}" > metadata.json
tar cfz ${CHAINCODE_NAME}-${ORG}.tgz code.tar.gz metadata.json
popd