Skip to content

Commit 13c8a5f

Browse files
committed
Enhance setup scripts: distribute event initiator public key to node configs and add build step in setup.sh
1 parent 7bcae76 commit 13c8a5f

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ node2
2424
config.yaml
2525
.vscode
2626
.vagrant
27+
.chain_code

setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
NUM_NODES=3
22

3+
make build
4+
35
echo "🚀 Start the services..."
46
docker compose up -d
57
sleep 3

setup_identities.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,23 @@ for i in $(seq 0 $((NUM_NODES-1))); do
6060
fi
6161
done
6262

63+
# Distribute event_initiator_pubkey to all node configs
64+
if [ -f "event_initiator.identity.json" ]; then
65+
INITIATOR_PUBKEY=$(grep -o '"public_key": *"[^"]*"' event_initiator.identity.json | cut -d '"' -f4)
66+
if [ -n "${INITIATOR_PUBKEY}" ]; then
67+
echo "📦 Distributing event_initiator_pubkey to node configs ..."
68+
for i in $(seq 0 $((NUM_NODES-1))); do
69+
if grep -q '^\s*event_initiator_pubkey:' "node$i/config.yaml"; then
70+
if [[ "${OSTYPE:-}" == darwin* ]]; then
71+
sed -i '' -E "s|^([[:space:]]*event_initiator_pubkey:).*|\1 \"${INITIATOR_PUBKEY}\"|" "node$i/config.yaml"
72+
else
73+
sed -i -E "s|^([[:space:]]*event_initiator_pubkey:).*|\1 \"${INITIATOR_PUBKEY}\"|" "node$i/config.yaml"
74+
fi
75+
fi
76+
done
77+
fi
78+
fi
79+
6380
# Distribute identity files to all nodes
6481
echo "🔄 Distributing identity files across nodes..."
6582
for i in $(seq 0 $((NUM_NODES-1))); do

0 commit comments

Comments
 (0)