Skip to content

Commit b79803b

Browse files
Fix python yq filter (#64)
1 parent 44a6fe8 commit b79803b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

rust/lit-node/lit-node/scripts/build_and_restart_no_sgx.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ if ! command -v yq &> /dev/null; then
55
exit 1
66
fi
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+
817
cargo build
918

1019
./scripts/multi-stop.sh
@@ -13,21 +22,21 @@ sleep 2
1322

1423
# Update the rpc-config.yaml file
1524
if [ -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)"
1726
else
1827
echo "rpc-config.yaml file does not exist, creating it from rpc-config.example.yaml"
1928
fi
2029

2130
# Check if there's an overlay file and merge on top of the example to create the final rpc-config.yaml file
2231
if [ -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."
2635
else
2736
echo "No overlay file found, using base configuration."
2837
cp ./rpc-config.example.yaml ./rpc-config.yaml
2938
fi
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
3342
cp ../target/debug/lit_node ./

0 commit comments

Comments
 (0)