From 678df7f8500147e6bd5096dec748bc45fbc0e3f0 Mon Sep 17 00:00:00 2001 From: RipleyBooya Date: Mon, 24 Feb 2025 01:47:48 +0100 Subject: [PATCH] Update entrypoint.tailscale.sh ENV TAILSCALE_PARAM="" # New: Allows full customization of tailscale up command ENV TAILSCALE_AUTH_KEY="" # Fallback if TAILSCALE_PARAM is empty/not set --- docker/entrypoint.tailscale.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docker/entrypoint.tailscale.sh b/docker/entrypoint.tailscale.sh index 0dbb4e2..93243aa 100644 --- a/docker/entrypoint.tailscale.sh +++ b/docker/entrypoint.tailscale.sh @@ -3,8 +3,8 @@ set -e # Vérification des variables d'environnement requises -if [ -z "$SSH_HOST" ] || [ -z "$SSH_USER" ] || [ -z "$REMOTE_PORTS" ] || [ -z "$LOCAL_PORTS" ] || [ -z "$TAILSCALE_AUTH_KEY" ]; then - echo "ERROR: Required variables (SSH_HOST, SSH_USER, REMOTE_PORTS, LOCAL_PORTS, TAILSCALE_AUTH_KEY) are missing." +if [ -z "$SSH_HOST" ] || [ -z "$SSH_USER" ] || [ -z "$REMOTE_PORTS" ] || [ -z "$LOCAL_PORTS" ]; then + echo "ERROR: Required variables (SSH_HOST, SSH_USER, REMOTE_PORTS, LOCAL_PORTS) are missing." exit 1 fi @@ -14,7 +14,17 @@ tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/var/run/tailsca sleep 5 echo "Connecting to Tailscale..." -tailscale up --authkey=${TAILSCALE_AUTH_KEY} --ssh + +# Vérifier si TAILSCALE_PARAM est défini, sinon utiliser la clé d'authentification par défaut +if [ -n "$TAILSCALE_PARAM" ]; then + tailscale up $TAILSCALE_PARAM +else + if [ -z "$TAILSCALE_AUTH_KEY" ]; then + echo "ERROR: Either TAILSCALE_PARAM or TAILSCALE_AUTH_KEY must be set." + exit 1 + fi + tailscale up --authkey=${TAILSCALE_AUTH_KEY} --ssh +fi # Vérifier que Tailscale est bien actif if ! tailscale status; then