Allow specifying client ID when running docker-compose (#101)

This also fixes up some handling of default values in the entrypoint.
This commit is contained in:
Dustin J. Mitchell
2025-03-03 17:39:59 -05:00
committed by GitHub
parent 7430d6feec
commit a7dc9e84b4
3 changed files with 36 additions and 6 deletions

View File

@ -2,12 +2,28 @@
set -e
echo "starting entrypoint script..."
if [ "$1" = "/bin/taskchampion-sync-server" ]; then
echo "setting data directories"
: ${DATA_DIR:=/var/lib/taskchampion-sync-server}
export DATA_DIR
echo "setting up data directory ${DATA_DIR}"
mkdir -p "${DATA_DIR}"
chown -R taskchampion:users "${DATA_DIR}"
chmod -R 700 "${DATA_DIR}"
: ${LISTEN:=0.0.0.0:8080}
export LISTEN
echo "Listen set to ${LISTEN}"
if [ -n "${CLIENT_ID}" ]; then
export CLIENT_ID
echo "Limiting to client ID ${CLIENT_ID}"
else
unset CLIENT_ID
fi
if [ "$(id -u)" = "0" ]; then
echo "switching to user 'taskchampion'"
echo "Running server as user 'taskchampion'"
exec su-exec taskchampion "$@"
fi
else
eval "${@}"
fi