Skip to content

Commit

Permalink
feat: handle retries when fetching from remote registry (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
elisanp authored Aug 6, 2024
1 parent 7353446 commit 36dc600
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion example/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
#!/bin/bash
. /.venv/bin/activate

MAX_RETRY=10
REMOTE_DATA_LOCATION="https://registry.spid.gov.it/entities-idp -O ./spid-entities-idps.xml"

# get IDEM MDQ key
if [[ $GET_IDEM_MDQ_KEY == true ]]; then
wget https://mdx.idem.garr.it/idem-mdx-service-crt.pem -O $SATOSA_KEYS_FOLDER/idem-mdx-service-crt.pem
wget https://registry.spid.gov.it/entities-idp -O metadata/idp/spid-entities-idps.xml

wget $REMOTE_DATA_LOCATION
status=$?
while [[ $status != 0 && $MAX_RETRY -gt 0 ]]; do
echo "Retrying download from registry.spid.gov.it..."
wget $REMOTE_DATA_LOCATION
status=$?
MAX_RETRY=$((MAX_RETRY-1))
done

if [ $MAX_RETRY == 0 ]; then
echo "Cannot fetch identity providers data from remote registry, aborting..."
exit 1
fi

echo "Downloaded IDEM MDQ key"
fi

Expand Down

0 comments on commit 36dc600

Please sign in to comment.