mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-01-01 14:16:18 +00:00
34 lines
839 B
Bash
34 lines
839 B
Bash
|
|
#!/bin/bash
|
||
|
|
set -e
|
||
|
|
|
||
|
|
# Set Timezone
|
||
|
|
if [ -n "$TZ" ]; then
|
||
|
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Enable IP forwarding
|
||
|
|
sysctl -w net.ipv4.ip_forward=1 > /dev/null 2>&1 || echo "Warning: Could not set net.ipv4.ip_forward"
|
||
|
|
|
||
|
|
# Check required variables
|
||
|
|
if [ -z "$MASTER_SERVER_ADDRESS" ]; then
|
||
|
|
echo "ERROR: MASTER_SERVER_ADDRESS is not set."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ -z "$TOKEN" ]; then
|
||
|
|
echo "ERROR: TOKEN is not set."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Check MASTER_SERVER_ADDRESS for HTTPS
|
||
|
|
if [[ "$MASTER_SERVER_ADDRESS" != https://* ]]; then
|
||
|
|
if [[ "$MASTER_SERVER_ADDRESS" == http://192.168.* ]]; then
|
||
|
|
echo "Warning: Using HTTP only for development."
|
||
|
|
else
|
||
|
|
echo "ERROR: MASTER_SERVER_ADDRESS must start with https://. Received: $MASTER_SERVER_ADDRESS"
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
|
||
|
|
exec "$@"
|