From 230be5a23d35e96d8bea6db1c14a23c119784788 Mon Sep 17 00:00:00 2001 From: Jon Mills <40585882+TheFlyingBadger@users.noreply.github.com> Date: Mon, 9 Sep 2019 11:44:07 +0800 Subject: [PATCH] Docker - Make --verbose optional based on environment variable (#651) * Add environment variables section into relevant document * Update entrypoint.sh to support --verbose via environment variable --- contrib/docker/entrypoint.sh | 10 +++++++++- docs/Docker.md | 10 ++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/contrib/docker/entrypoint.sh b/contrib/docker/entrypoint.sh index 06abfb37..59d5ab0a 100755 --- a/contrib/docker/entrypoint.sh +++ b/contrib/docker/entrypoint.sh @@ -26,7 +26,15 @@ fi chown "${oduser}:${odgroup}" /onedrive/ /onedrive/conf # Default parameters -ARGS=(--monitor --verbose --confdir /onedrive/conf --syncdir /onedrive/data) +ARGS=(--monitor --confdir /onedrive/conf --syncdir /onedrive/data) + +#Make Verbose output optional, based on an environment variable +# default behaviour is verbose (to continue to behave as before) +if ! [ "${ONEDRIVE_VERBOSE:=1}" == "0" ]; then + echo "# We are being verbose" + echo "# set ONEDRIVE_VERBOSE environment to 0 (Zero) to be less chatty" + ARGS=(--verbose ${ARGS[@]}) +fi if [ ${#} -gt 0 ]; then ARGS=("${@}") diff --git a/docs/Docker.md b/docs/Docker.md index aec9adf8..932b3199 100644 --- a/docs/Docker.md +++ b/docs/Docker.md @@ -116,6 +116,16 @@ docker inspect onedrive > /dev/null && docker rm -f onedrive docker run $firstRun --restart unless-stopped --name onedrive -v onedrive_conf:/onedrive/conf -v "${onedriveDir}:/onedrive/data" driveone/onedrive ``` + +## Environment Variables + + +| Variable | Purpose | Sample Value | +| ---------------- | --------------------------------------------------- |:-------------:| +| ONEDRIVE_UID | UserID (UID) to run as | 1000 | +| ONEDRIVE_GID | GroupID (GID) to run as | 1000 | +| ONEDRIVE_VERBOSE | Controls "verbose" switch on onedrive sync. Default (i.e. not set or non-zero value) behaviour is to continue to be verbose as before | 0 | + ## Build instructions You can also build your own image instead of pulling the one from dockerhub: ```bash