Defaults to WEBDAV_* for username and password if not provided (#1)

This commit is contained in:
Ian 2018-04-12 10:49:56 -07:00 committed by GitHub
parent 1741501f11
commit 8a22e80d99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
Readme.md

View File

@ -2,7 +2,7 @@ FROM alpine
MAINTAINER ViViDboarder <ViViDboarder@gmail.com>
RUN apk -Uuv add curl ca-certificates
ADD push.sh /bin/
COPY push.sh /bin/
RUN chmod +x /bin/push.sh
ENTRYPOINT /bin/push.sh

9
push.sh Normal file → Executable file
View File

@ -1,7 +1,16 @@
#! /bin/sh
# Use WEBDAV_USERNAME or WEBDAV_PASSWORD as default, if provided
if [ -z "$PLUGIN_USERNAME" ] && [ ! -z "$WEBDAV_USERNAME" ]; then
PLUGIN_USERNAME="$WEBDAV_USERNAME"
fi
if [ -z "$PLUGIN_PASSWORD" ] && [ ! -z "$WEBDAV_PASSWORD" ]; then
PLUGIN_PASSWORD="$WEBDAV_PASSWORD"
fi
# If username and password are provided, add auth
if [ ! -z "$PLUGIN_USERNAME" ] && [ ! -z "$PLUGIN_PASSWORD" ]; then
AUTH="-u ${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}"
fi
curl -T $PLUGIN_FILE $AUTH $PLUGIN_DESTINATION