Skip to content

Commit

Permalink
use set env script
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-shashank committed Jun 6, 2024
1 parent 18ee0c0 commit 7a8c5aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ansible/archival-snapshots/resources/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ sleep 30
echo "Forest process started with PID: $FOREST_NODE_PID"

# Set required env variables
ADMIN_TOKEN=$(cat admin_token)
export FULLNODE_API_INFO="$ADMIN_TOKEN:/ip4/127.0.0.1/tcp/3456/http"
echo "USING TOKEN: $FULLNODE_API_INFO"
./set_env.sh

echo "Waiting for forest to sync to latest network head"
$FOREST_CLI sync wait
Expand All @@ -50,7 +48,8 @@ LATEST_EPOCH=$($FOREST_CLI sync status | grep "Height:" | awk '{print $2}')
echo "Latest Height: $LATEST_EPOCH"

while ((LATEST_EPOCH - CURRENT_EPOCH > 30000)); do
export FULLNODE_API_INFO="$ADMIN_TOKEN:/ip4/127.0.0.1/tcp/3456/http"
export $FULLNODE_API_INFO
echo "USING FULLNODE API: $FULLNODE_API_INFO"
NEW_EPOCH=$((CURRENT_EPOCH + 30000))
echo "Next Height: $NEW_EPOCH"

Expand Down
14 changes: 14 additions & 0 deletions ansible/archival-snapshots/resources/set_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Update FULLNODE_API_INFO function
update_fullnode_api_info() {
ADMIN_TOKEN=$(cat admin_token)
export FULLNODE_API_INFO="$ADMIN_TOKEN:/ip4/127.0.0.1/tcp/3456/http"
}

# Execute update_fullnode_api_info
update_fullnode_api_info
echo "Using FULLNODE API: $FULLNODE_API_INFO"

# Source this script to update the variable in the current shell
source "$0"

0 comments on commit 7a8c5aa

Please sign in to comment.