mirror of
https://github.com/ViViDboarder/drone-webdav.git
synced 2025-01-04 19:47:33 +00:00
Defaults to WEBDAV_* for username and password if not provided (#1)
This commit is contained in:
parent
1741501f11
commit
8a22e80d99
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
Readme.md
|
@ -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
9
push.sh
Normal file → Executable 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
|
||||
|
Loading…
Reference in New Issue
Block a user