Files
ttyd/scripts/run.sh
2026-02-02 22:14:46 +01:00

29 lines
633 B
Bash

#!/bin/bash
set -e
TTYD_PORT="${TTYD_PORT:-7681}"
TTYD_COMMAND="${TTYD_COMMAND:-/bin/bash}"
TTYD_CREDENTIAL="${TTYD_CREDENTIAL:-}"
TTYD_OPTIONS="${TTYD_OPTIONS:-}"
# Build command arguments
args=()
args+=("--port" "$TTYD_PORT")
# Add authentication if set
if [ -n "$TTYD_CREDENTIAL" ]; then
args+=("--credential" "$TTYD_CREDENTIAL")
fi
# Add any extra options
if [ -n "$TTYD_OPTIONS" ]; then
# shellcheck disable=SC2206
args+=($TTYD_OPTIONS)
fi
echo "Starting ttyd on port $TTYD_PORT..."
echo "Command: $TTYD_COMMAND"
[ -n "$TTYD_CREDENTIAL" ] && echo "Authentication: enabled"
exec ttyd "${args[@]}" $TTYD_COMMAND