2023-03-30 04:14:15 +00:00
|
|
|
#!/bin/sh
|
2023-04-05 11:56:38 +00:00
|
|
|
set -e
|
|
|
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2023-03-30 04:14:15 +00:00
|
|
|
|
|
|
|
# Assign deployed contract address from server config
|
2023-04-03 12:43:29 +00:00
|
|
|
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
|
2023-03-30 04:14:15 +00:00
|
|
|
|
2023-04-05 11:56:38 +00:00
|
|
|
if [ -f /geth-accounts/accounts.csv ]; then
|
|
|
|
echo "Using L1 private key from the mounted volume"
|
|
|
|
# Read the private key of L1 account for sending txs from peer
|
|
|
|
PRIVATE_KEY_PEER=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv)
|
|
|
|
else
|
|
|
|
echo "Using PRIVATE_KEY_PEER from env"
|
|
|
|
fi
|
|
|
|
|
|
|
|
sed "s/REPLACE_WITH_PRIVATE_KEY/${PRIVATE_KEY_PEER}/" environments/watcher-config-template.toml > environments/local.toml
|
2023-04-03 12:43:29 +00:00
|
|
|
sed -i "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/local.toml
|
2023-03-30 04:14:15 +00:00
|
|
|
|
2023-04-05 11:56:38 +00:00
|
|
|
export L2_GETH_URL="http://${L2_GETH_HOST}:${L2_GETH_PORT}"
|
|
|
|
sed -i 's|REPLACE_WITH_L2_GETH_URL|'"${L2_GETH_URL}"'|' environments/local.toml
|
|
|
|
|
2023-03-30 04:14:15 +00:00
|
|
|
echo 'yarn server'
|
|
|
|
yarn server
|