File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44# This script sets up identities for testing with separate test database paths
55set -e
66
7+ # Cross-platform sed in-place function
8+ # macOS requires backup extension, Linux doesn't
9+ sed_inplace () {
10+ if [[ " $OSTYPE " == " darwin" * ]]; then
11+ # macOS
12+ sed -i ' ' " $@ "
13+ else
14+ # Linux and others
15+ sed -i " $@ "
16+ fi
17+ }
18+
719# Number of test nodes
820NUM_NODES=3
921BASE_DIR=" $( pwd) "
@@ -97,14 +109,14 @@ if [ -f "test_event_initiator.identity.json" ]; then
97109 # Update all test node config files with the actual public key and password
98110 for i in $( seq 0 $(( NUM_NODES- 1 )) ) ; do
99111 # Update public key using sed with | as delimiter (safer than /)
100- sed -i " s|event_initiator_pubkey:.*|event_initiator_pubkey: $PUBKEY |g" " $BASE_DIR /test_node$i /config.yaml"
112+ sed_inplace " s|event_initiator_pubkey:.*|event_initiator_pubkey: $PUBKEY |g" " $BASE_DIR /test_node$i /config.yaml"
101113 # Update password using sed with | as delimiter and escaped password
102- sed -i " s|badger_password:.*|badger_password: $ESCAPED_PASSWORD |g" " $BASE_DIR /test_node$i /config.yaml"
114+ sed_inplace " s|badger_password:.*|badger_password: $ESCAPED_PASSWORD |g" " $BASE_DIR /test_node$i /config.yaml"
103115 done
104116
105117 # Also update the main config.test.yaml
106- sed -i " s|event_initiator_pubkey:.*|event_initiator_pubkey: $PUBKEY |g" " $BASE_DIR /config.test.yaml"
107- sed -i " s|badger_password:.*|badger_password: $ESCAPED_PASSWORD |g" " $BASE_DIR /config.test.yaml"
118+ sed_inplace " s|event_initiator_pubkey:.*|event_initiator_pubkey: $PUBKEY |g" " $BASE_DIR /config.test.yaml"
119+ sed_inplace " s|badger_password:.*|badger_password: $ESCAPED_PASSWORD |g" " $BASE_DIR /config.test.yaml"
108120
109121 echo " ✅ Event initiator public key updated: $PUBKEY "
110122 echo " ✅ Badger password updated: $BADGER_PASSWORD "
You can’t perform that action at this time.
0 commit comments