mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-21 09:39:46 -05:00
29 lines
585 B
Bash
29 lines
585 B
Bash
#!/bin/sh
|
|
|
|
PUID=${PUID:-1000}
|
|
PGID=${PGID:-1000}
|
|
SPOOLMAN_PORT=${SPOOLMAN_PORT:-8000}
|
|
SPOOLMAN_HOST=${SPOOLMAN_HOST:-0.0.0.0}
|
|
|
|
fail() {
|
|
echo "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
if [ "$(id -u app)" -ne "$PUID" ]; then
|
|
usermod -o -u "$PUID" app ||
|
|
fail "Failed to update app UID to $PUID"
|
|
fi
|
|
|
|
if [ "$(id -g app)" -ne "$PGID" ]; then
|
|
groupmod -o -g "$PGID" app ||
|
|
fail "Failed to update app GID to $PGID"
|
|
fi
|
|
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
exec gosu "app" "$0" "$@"
|
|
# NOT REACHABLE
|
|
fi
|
|
|
|
exec uvicorn spoolman.main:app --host $SPOOLMAN_HOST --port $SPOOLMAN_PORT "$@"
|