Files
mtproxy-docker/entrypoint.sh

43 lines
857 B
Bash
Raw Permalink Normal View History

2026-01-26 22:52:48 +01:00
#!/bin/bash
if [ ! -f /data/proxy-secret ] || [ ! -f /data/proxy-multi.conf ]; then
echo "Downloading initial configuration..."
/usr/local/bin/update-config.sh
fi
echo "0 3 * * * /usr/local/bin/update-config.sh" | crontab -
cron
if [ -z "$SECRET" ]; then
echo "ERROR: SECRET environment variable is not set!"
exit 1
fi
WORKERS=${WORKERS:-1}
PORT=${PORT:-443}
STATS_PORT=${STATS_PORT:-8888}
USER=${USER:-nobody}
TAG_OPTION=""
if [ -n "$PROXY_TAG" ]; then
TAG_OPTION="-P $PROXY_TAG"
fi
echo "Starting MTProxy..."
echo "Port: $PORT"
echo "Stats port: $STATS_PORT"
echo "Workers: $WORKERS"
echo "Secret: ${SECRET:0:8}..."
exec mtproto-proxy \
-u $USER \
-p $STATS_PORT \
-H $PORT \
-S $SECRET \
$TAG_OPTION \
--aes-pwd /data/proxy-secret \
/data/proxy-multi.conf \
-M $WORKERS \
--address 0.0.0.0