You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.7 KiB
40 lines
1.7 KiB
#!/bin/bash |
|
|
|
# TUSDaemon default settings |
|
|
|
# The default TUSD working directory. |
|
TUSD_WORKINGDIR="${PWD}" |
|
# The TUSD Go executable location. |
|
TUSD_EXECUTABLE="${TUSD_WORKINGDIR}/tusd" |
|
# The TUSD upload folder where the files are temporary stored during uploads. |
|
TUSD_UPLOADDIR="${TUSD_WORKINGDIR}/upload_data" |
|
# Fixed setting in order to make TUSD work behind NGINX. |
|
TUSD_ARGUMENTS="-behind-proxy" |
|
# The location of the web hooks scripts. These are used for communicating with the REST API. |
|
TUSD_HOOKDIR="${TUSD_WORKINGDIR}/hooks" |
|
# Fixed setting which hooks are currently used. |
|
TUSD_ENABLED_HOOKS="post-finish,pre-create" |
|
|
|
# Check if OS variables are set though a Docker setup. Then these three values are already set and no .env file is needed |
|
if [[ ${WEBHOOK_URL} = "" && ${DROPOFF_API_HAWK_KEY} = "" && ${DROPOFF_API_HAWK_SECRET} = "" && ! -f .env ]]; then |
|
echo "Please create a configuration file (.env) first." |
|
exit 1 |
|
fi |
|
|
|
if [ -f .env ]; then |
|
# Every default variable above here can be changed the the '.env' file |
|
source .env |
|
fi |
|
|
|
# Check if reqruired encryption binary is available. If not, stop working and give a message |
|
if [ ! -f /usr/bin/encfs ]; then |
|
echo "Please install EncFS to support encryption: sudo apt install encfs" |
|
exit 1 |
|
fi |
|
|
|
# Webhook logic in TUS can only be either '-hooks-dir' or '-hooks-http' and not both. This is due to the blocking behavior of certain webhooks. |
|
# Start with Webhook files |
|
"${TUSD_EXECUTABLE}" "${TUSD_ARGUMENTS}" -upload-dir "${TUSD_UPLOADDIR}" -hooks-dir "${TUSD_HOOKDIR}" -hooks-enabled-events "${TUSD_ENABLED_HOOKS}" |
|
|
|
# Start with webhook urls |
|
#"${TUSD_EXECUTABLE}" "${TUSD_ARGUMENTS}" -upload-dir "${TUSD_UPLOADDIR}" -hooks-http "${WEBHOOK_URL}" -hooks-enabled-events "${TUSD_ENABLED_HOOKS}" |