read keys from foundry config and write to shared file

This commit is contained in:
stubbsta 2024-05-24 10:01:36 +02:00
parent 82267811f8
commit 00e8d65ba8
No known key found for this signature in database
2 changed files with 23 additions and 2 deletions

View File

@ -21,11 +21,14 @@ services:
--port=8545
--host=0.0.0.0
--chain-id=1337
--accounts=1
--accounts=${NUM_NWAKU_NODES:-5}
--allow-origin=*
--block-time=12
--silent
--config-out=anvil-config.txt
volumes:
- privatekeys-volume:/shared
- ./getPrivateKeys.sh:/getPrivateKeys.sh
networks:
- simulation
@ -216,4 +219,7 @@ services:
- redis
- foundry
networks:
- simulation
- simulation
volumes:
privatekeys-volume:

15
getPrivateKeys.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/sh
# Install json parser
apk update
apk add jq
# Read the JSON file
json_content=$(cat anvil-config.txt)
# Extract private_keys array values using jq
private_keys=$(echo "$json_content" | jq -r '.private_keys[]')
# Write private keys to a new file for easier access
echo "Writing private keys to file"
echo "$private_keys" > /shared/private-keys.txt