File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
12set -euo pipefail
23
34# ## generate pgpass file
3132
3233
3334 DB_MAX_BLOCK=$( psql -h $PGHOST $PGDATABASE -U $PGUSER -t -c ' select max (block_no) from block;' )
35+ # Ensure DB_MAX_BLOCK is a valid integer, if not, exit with an error
36+ if ! [[ " $DB_MAX_BLOCK " =~ ^[0-9]+$ ]]; then
37+ echo " Block in db:" $DB_MAX_BLOCK
38+ DB_MAX_BLOCK=0
39+ exit 1
40+ fi
3441 NODE_CUR_BLOCK=0
3542 while [ $NODE_CUR_BLOCK -lt $DB_MAX_BLOCK ]; do
3643 NODE_STATUS=" $( cardano-cli query tip --mainnet 2> /dev/null || true) "
@@ -54,7 +61,7 @@ CONFIG_HOME="/environments"
5461if [ -z " ${NETWORK:- } " ]; then
5562 echo " NETWORK is not set, defaulting to mainnet"
5663 NETWORK=" mainnet"
57- NO_NETWORK_SET=1
64+ NO_NETWORK_SET=" 1 "
5865else
5966 echo " NETWORK is set to $NETWORK "
6067fi
7683if [[ -z " ${DB_SYNC_CONFIG:- } " ]]; then
7784 DB_SYNC_CONFIG=" $CONFIG_HOME /$NETWORK "
7885
79- elif [[ -z " ${NO_NETWORK_SET} " ]]; then # dbsync config is set and network is not
86+ elif [[ -z " ${NO_NETWORK_SET:- } " ]]; then # dbsync config is set and network is not
8087 DB_SYNC_CONFIG=" $CONFIG_HOME "
8188
8289else # # both NETWORK and DB_SYNC_CONFIG are set
@@ -90,7 +97,7 @@ else ## both NETWORK and DB_SYNC_CONFIG are set
9097fi
9198
9299
93- SCHEMA_DIR=$( find /nix/store -name -type d ' *-schema' ) }
100+ SCHEMA_DIR=$( find /nix/store -name ' *-schema' ) }
94101
95102exec cardano-db-sync \
96103 --config " $DB_SYNC_CONFIG " \
You can’t perform that action at this time.
0 commit comments