From c7eabab27ba5549c2da77678eb59023a411f0f32 Mon Sep 17 00:00:00 2001
From: Pavel Pivovarov <1425787+piv-pav@users.noreply.github.com>
Date: Sat, 11 Jun 2022 07:55:08 +1000
Subject: [PATCH] Added ONEDRIVE_UPLOADONLY flag for Docker (#2002)
* Added ONEDRIVE_UPLOADONLY environment variable
---
contrib/docker/entrypoint.sh | 7 +++++++
docs/Docker.md | 1 +
2 files changed, 8 insertions(+)
diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh
index 1a8f14d7..42252a6e 100755
--- a/contrib/docker/entrypoint.sh
+++ b/contrib/docker/entrypoint.sh
@@ -62,6 +62,13 @@ if [ "${ONEDRIVE_DOWNLOADONLY:=0}" == "1" ]; then
ARGS=(--download-only ${ARGS[@]})
fi
+# Tell client to sync in upload-only mode based on environment variable
+if [ "${ONEDRIVE_UPLOADONLY:=0}" == "1" ]; then
+ echo "# We are synchronizing in upload-only mode"
+ echo "# Adding --upload-only"
+ ARGS=(--upload-only ${ARGS[@]})
+fi
+
# Tell client to logout based on environment variable
if [ "${ONEDRIVE_LOGOUT:=0}" == "1" ]; then
echo "# We are logging out"
diff --git a/docs/Docker.md b/docs/Docker.md
index 51e3688b..7307c64e 100644
--- a/docs/Docker.md
+++ b/docs/Docker.md
@@ -205,6 +205,7 @@ docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/
| ONEDRIVE_DEBUG_HTTPS | Controls "--debug-https" switch on onedrive sync. Default is 0 | 1 |
| ONEDRIVE_RESYNC | Controls "--resync" switch on onedrive sync. Default is 0 | 1 |
| ONEDRIVE_DOWNLOADONLY | Controls "--download-only" switch on onedrive sync. Default is 0 | 1 |
+| ONEDRIVE_UPLOADONLY | Controls "--upload-only" switch on onedrive sync. Default is 0 | 1 |
| ONEDRIVE_LOGOUT | Controls "--logout" switch. Default is 0 | 1 |
| ONEDRIVE_REAUTH | Controls "--reauth" switch. Default is 0 | 1 |
| ONEDRIVE_AUTHFILES | Controls "--auth-files" option. Default is "" | "authUrl:responseUrl" |