docker-restic-server/root/etc/s6.d/restic/run
Jan Christian Grünhage ada3d11ac4
All checks were successful
the build was successful
initial impl
2018-03-29 12:32:02 +02:00

33 lines
760 B
Bash
Executable file

#!/usr/bin/env bash
if [[ -z ${BACKUP_PATH} ]]; then
BACKUP_PATH="/backup"
fi
COMMAND="rest-server --path ${BACKUP_PATH}"
if [[ -n ${APPEND_ONLY} ]]; then
COMMAND="${COMMAND} --append-only"
fi
if [[ -n ${NO_AUTH} ]]; then
COMMAND="${COMMAND} --no-auth"
fi
if [[ -n ${PROMETHEUS} ]]; then
COMMAND="${COMMAND} --prometheus"
fi
if [[ -n ${PRIVATE_REPOS} ]]; then
COMMAND="${COMMAND} --private-repos"
fi
if [[ -n ${PORT} ]]; then
COMMAND="${COMMAND} --port ${PORT}"
fi
if [[ -n ${DEBUG} ]]; then
COMMAND="${COMMAND} --debug"
fi
if [[ -n ${CPU_PROFILE} ]]; then
COMMAND="${COMMAND} --cpu-profile"
fi
if [[ ! -f ${BACKUP_PATH}/.htpasswd ]]; then
touch ${BACKUP_PATH}/.htpasswd
fi
chown -R ${UID}:${GID} ${BACKUP_PATH}
exec su-exec ${UID}:${GID} ${COMMAND}