diff --git a/assets/cron/docker-entrypoint.sh b/assets/cron/docker-entrypoint.sh index 901e7d4..7849471 100644 --- a/assets/cron/docker-entrypoint.sh +++ b/assets/cron/docker-entrypoint.sh @@ -17,10 +17,34 @@ # along with this program. If not, see . # Check mandatory Seafile configuration have been properly set. -if [ -z $SEAF_SERVER_URL ]; then echo "The \$SEAF_SERVER_URL was not defined. Stopping container..."; exit 1; fi -if [ -z $SEAF_USERNAME ]; then echo "The \$SEAF_USERNAME was not defined. Stopping container..."; exit 1; fi -if [ -z $SEAF_PASSWORD ]; then echo "The \$SEAF_PASSWORD was not defined. Stopping container..."; exit 1; fi -if [ -z $SEAF_LIBRARY_UUID ]; then echo "The \$SEAF_LIBRARY_UUID was not defined. Stopping container..."; exit 1; fi +if [ -z $SEAF_SERVER_URL ]; then + echo "The \$SEAF_SERVER_URL is not defined. Stopping container..." + exit 1 +fi +if [ -z $SEAF_USERNAME ]; then + echo "The \$SEAF_USERNAME is not defined. Stopping container..." + exit 1 +fi +if [ -z $SEAF_PASSWORD ]; then + echo "The \$SEAF_PASSWORD is not defined. Stopping container..." + exit 1 +fi +if [ -z $SEAF_LIBRARY_UUID ]; then + echo "The \$SEAF_LIBRARY_UUID is not defined. Stopping container..." + exit 1 +fi +if [ -n "$SEAF_UPLOAD_LIMIT" ] +&& [[ $SEAF_UPLOAD_LIMIT =~ ^[0-9]+$ ]] +&& [ "$SEAF_UPLOAD_LIMIT" -gt 0 ]; then + echo "The \$SEAF_UPLOAD_LIMIT is not an integer greater than 0. Stopping container..." + exit 1 +fi +if [ -n "$SEAF_DOWNLOAD_LIMIT" ] +&& [[ $SEAF_DOWNLOAD_LIMIT =~ ^[0-9]+$ ]] +&& [ "$SEAF_DOWNLOAD_LIMIT" -gt 0 ]; then + echo "The \$SEAF_DOWNLOAD_LIMIT is not an integer greater than 0. Stopping container..." + exit 1 +fi # Update the user ID, if the $UID changed. if [ "$UID" != "1000" ]; then @@ -49,6 +73,9 @@ su - $UNAME << EO export SEAF_USERNAME=$SEAF_USERNAME export SEAF_PASSWORD=$SEAF_PASSWORD export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID + export SEAF_SKIP_SSL_CERT=$SEAF_SKIP_SSL_CERT + test -n "$SEAF_UPLOAD_LIMIT" && export SEAF_UPLOAD_LIMIT=$SEAF_UPLOAD_LIMIT + test -n "$SEAF_DOWNLOAD_LIMIT" && export SEAF_DOWNLOAD_LIMIT=$SEAF_DOWNLOAD_LIMIT export UNAME=$UNAME /bin/bash /home/seafuser/entrypoint.sh EO diff --git a/assets/cron/seafile-entrypoint.sh b/assets/cron/seafile-entrypoint.sh index 2a2baec..dbf22e3 100644 --- a/assets/cron/seafile-entrypoint.sh +++ b/assets/cron/seafile-entrypoint.sh @@ -31,5 +31,12 @@ while [ ! -f $seafile_ini ]; do sleep 1; done /usr/bin/seaf-cli start while [ ! -S $seafile_sock ]; do sleep 1; done +# Set the disable_verify_certificate key to true only if the environment variable is true. +test "$SEAF_SKIP_SSL_CERT" = true && seaf-cli config -k disable_verify_certificate -v true + +# Set the upload/download limits +test -n "$SEAF_UPLOAD_LIMIT" && seaf-cli config -k upload_limit -v $SEAF_UPLOAD_LIMIT +test -n "$SEAF_DOWNLOAD_LIMIT" && seaf-cli config -k download_limit -v $SEAF_DOWNLOAD_LIMIT + # Start the synchronisation. /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume \ No newline at end of file