mirror of
https://github.com/DarthJahus/mtproxy-docker.git
synced 2026-05-17 08:16:01 +03:00
43 lines
857 B
Bash
43 lines
857 B
Bash
#!/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
|