88# Exit the script immediately if any command fails.
99set -e
1010
11- # Optional path to a read-only server list
12- : " ${INITIAL_SERVERS_PATH:= " " } "
11+ # Environment Variables
12+
13+ # (Optional) Path to an initial server list to be copied into the container.
14+ INITIAL_SERVERS_PATH=" ${INITIAL_SERVERS_PATH:- } "
15+
16+ # (Optional) Additional arguments to pass to the tailscaled command.
17+ # Example: "--tun=userspace-networking"
18+ TAILSCALED_EXTRA_ARGS=" ${TAILSCALED_EXTRA_ARGS:- } "
19+
20+ # Additional arguments to pass to the tailscale set command.
21+ # Default: "--advertise-exit-node --accept-dns=false --webclient"
22+ TAILSCALE_EXTRA_ARGS=" ${TAILSCALE_EXTRA_ARGS:- --advertise-exit-node --accept-dns=false --webclient} "
1323
1424# If the environment variable INITIAL_SERVERS_PATH is set,
1525# create the /gluetun directory and copy the initial servers file.
@@ -28,15 +38,18 @@ ethtool -K $NETDEV rx-udp-gro-forwarding on rx-gro-list off
2838
2939# Start the Tailscale daemon in the background.
3040echo " Starting the Tailscale daemon..."
31- /app/tailscaled --statedir=/var/lib/tailscale &
41+ /app/tailscaled --statedir=/var/lib/tailscale ${TAILSCALED_EXTRA_ARGS} &
3242
3343# Sleep for 5 seconds to allow the Tailscale daemon to initialize.
3444echo " Sleeping for 5 seconds to allow the Tailscale daemon to initialize..."
3545sleep 5
3646
37- # Bring up the Tailscale connection and advertise this node as an exit node.
38- echo " Connecting Tailscale and advertising this node as an exit node..."
39- /app/tailscale set --advertise-exit-node --accept-dns=false --webclient
47+ # Apply configuration settings with tailscale set.
48+ echo " Setting Tailscale configuration..."
49+ /app/tailscale set ${TAILSCALE_EXTRA_ARGS}
50+
51+ # Bring up the Tailscale connection.
52+ echo " Connecting Tailscale..."
4053/app/tailscale up
4154
4255# Allow some time (5 seconds) for the Tailscale connection to establish.
0 commit comments