From 0c997d883f06d4aed3d4ce527056cb85453bc22a Mon Sep 17 00:00:00 2001 From: Harry Chen Date: Sat, 22 Aug 2020 19:43:53 +0800 Subject: [PATCH] Do not specify s3 endpoint when TUNASYNC_S3_ENDPOINT is not set Signed-off-by: Harry Chen --- s3.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/s3.sh b/s3.sh index 6e1d6ed..b7ea9ac 100755 --- a/s3.sh +++ b/s3.sh @@ -1,5 +1,12 @@ #!/bin/bash +if [[ ! -z "${TUNASYNC_S3_ENDPOINT}" ]]; then + ENDPOINT="--endpoint-url=${TUNASYNC_S3_ENDPOINT}" +else + ENDPOINT="" +fi + [[ ! -d "${TUNASYNC_WORKING_DIR}" ]] && mkdir -p "${TUNASYNC_WORKING_DIR}" mkdir /tmp/none; cd /tmp/none # enter an empty folder, so the stars in TUNASYNC_AWS_OPTIONS are not expanded -exec aws --no-sign-request --endpoint-url="${TUNASYNC_S3_ENDPOINT}" s3 sync ${TUNASYNC_AWS_OPTIONS} "${TUNASYNC_UPSTREAM_URL}" "${TUNASYNC_WORKING_DIR}" +exec aws --no-sign-request ${ENDPOINT} s3 sync ${TUNASYNC_AWS_OPTIONS} "${TUNASYNC_UPSTREAM_URL}" "${TUNASYNC_WORKING_DIR}" +