Skip to content

Commit

Permalink
Verify required environment variables are set
Browse files Browse the repository at this point in the history
  • Loading branch information
dalenewby committed Jul 18, 2024
1 parent 4aa356e commit f610a39
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions sync-s3-to-b2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,45 @@ STATUS=0

echo "${MYNAME}: Started"

if [ "${B2_APPLICATION_KEY_ID}" = "" ]; then
echo "${MYNAME}: FATAL: environment variable B2_APPLICATION_KEY_ID is required."
STATUS=1
fi

if [ "${B2_APPLICATION_KEY}" = "" ]; then
echo "${MYNAME}: FATAL: environment variable B2_APPLICATION_KEY is required."
STATUS=1
fi

if [ "${AWS_ACCESS_KEY}" = "" ]; then
echo "${MYNAME}: FATAL: environment variable AWS_ACCESS_KEY is required."
STATUS=1
fi

if [ "${AWS_SECRET_KEY}" = "" ]; then
echo "${MYNAME}: FATAL: environment variable AWS_SECRET_KEY is required."
STATUS=1
fi

if [ "${AWS_REGION}" = "" ]; then
echo "${MYNAME}: FATAL: environment variable AWS_REGION is required."
STATUS=1
fi

if [ "${B2_BUCKET}" = "" ]; then
echo "${MYNAME}: FATAL: environment variable B2_BUCKET is required."
STATUS=1
fi

if [ "${S3_BUCKET}" = "" ]; then
echo "${MYNAME}: FATAL: environment variable S3_BUCKET is required."
STATUS=1
fi

if [ $STATUS -ne 0 ]; then
exit $STATUS
fi

echo "${MYNAME}: Configuring rclone"

mkdir -p ~/.config/rclone
Expand Down

0 comments on commit f610a39

Please sign in to comment.