@@ -5,6 +5,15 @@ if ! command -v yq &> /dev/null; then
55 exit 1
66fi
77
8+ # This script expects Python yq (kislyuk/yq), which uses jq filters.
9+ merge_rpc_config () {
10+ local base_cfg=" $1 "
11+ local overlay_cfg=" $2 "
12+
13+ # Slurp both files and merge base with overlay.
14+ yq -s -y ' .[0] * .[1]' " $base_cfg " " $overlay_cfg "
15+ }
16+
817cargo build
918
1019./scripts/multi-stop.sh
@@ -13,21 +22,21 @@ sleep 2
1322
1423# Update the rpc-config.yaml file
1524if [ -f " ./rpc-config.yaml" ]; then
16- echo " rpc-config.yaml file has $( yq ' .chains | length' ./rpc-config.yaml) network definitions (pre-update)"
25+ echo " rpc-config.yaml file has $( yq -r ' .chains | length' ./rpc-config.yaml) network definitions (pre-update)"
1726else
1827 echo " rpc-config.yaml file does not exist, creating it from rpc-config.example.yaml"
1928fi
2029
2130# Check if there's an overlay file and merge on top of the example to create the final rpc-config.yaml file
2231if [ -f " ./rpc-config.overlay.yaml" ]; then
2332 echo " Found rpc-config.overlay.yaml, merging with base configuration..."
24- yq eval-all ' select(fileIndex == 0) * select(fileIndex == 1) ' ./rpc-config.example.yaml ./rpc-config.overlay.yaml > ./rpc-config.yaml
33+ merge_rpc_config ./rpc-config.example.yaml ./rpc-config.overlay.yaml > ./rpc-config.yaml
2534 echo " Configuration overlay applied successfully."
2635else
2736 echo " No overlay file found, using base configuration."
2837 cp ./rpc-config.example.yaml ./rpc-config.yaml
2938fi
30- echo " rpc-config.yaml file has $( yq ' .chains | length' ./rpc-config.yaml) network definitions (post-update)"
39+ echo " rpc-config.yaml file has $( yq -r ' .chains | length' ./rpc-config.yaml) network definitions (post-update)"
3140
3241# Dump the binary to `lit-node/lit-node` so it's in the same folder as its config files
3342cp ../target/debug/lit_node ./
0 commit comments