Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-shashank committed Jun 6, 2024
1 parent f4cf2ef commit 1abb3a7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ansible/archival-snapshots/resources/set_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ ADMIN_TOKEN=$(cat admin_token)
export FULLNODE_API_INFO="$ADMIN_TOKEN:/ip4/127.0.0.1/tcp/3456/http"

# Save the environment variable to a file and source it
if echo "export FULLNODE_API_INFO=\"$FULLNODE_API_INFO\"" > ./forest-archival.env && source ./forest-archival.env; then
echo "Environment variable saved to and loaded from /tmp/forest-archival.env"
if echo "export FULLNODE_API_INFO=\"$FULLNODE_API_INFO\"" > ./forest-archival.env; then
echo "Environment variable saved to ./forest-archival.env"
else
echo "Failed to save environment variable to ./forest-archival.env"
exit 1
fi

# Check if the file exists before sourcing it
if [ -f "./forest-archival.env" ]; then
source ./forest-archival.env
echo "Environment variable loaded from ./forest-archival.env"
else
echo "Failed to load environment variable from ./forest-archival.env"
exit 1
fi

# Use the environment variable
Expand Down

0 comments on commit 1abb3a7

Please sign in to comment.