Compare commits

..

1 Commits

Author SHA1 Message Date
13c2948036 feat: auto-login to tailscale in devcontainer 2026-03-24 22:19:40 +00:00
3 changed files with 23 additions and 2 deletions

View File

@@ -10,7 +10,7 @@
"context": ".",
"dockerfile": "Dockerfile"
},
"postCreateCommand": "bun install",
"postCreateCommand": "bun install && ./scripts/setup-tailscale.sh",
"postStartCommand": "./scripts/setup-git.sh && ./scripts/setup-nvim.sh",
// Features add additional features to your environment. See https://containers.dev/features
// Beware: features are not supported on all platforms and may have unintended side-effects.

View File

@@ -36,4 +36,4 @@ services:
commands:
start: |
gitpod --context environment environment port open 5174 --name "Admin Dashboard" --protocol https
cd apps/admin-dashboard && bun run dev --host
cd apps/admin-dashboard && bun run dev

21
scripts/setup-tailscale.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Tailscale setup script
# Authenticates with Tailscale if TS_AUTH_KEY is set and Tailscale is not already logged in
set -e
if [ -z "$TS_AUTH_KEY" ]; then
echo "TS_AUTH_KEY is not set, skipping Tailscale login."
exit 0
fi
STATUS=$(tailscale status 2>&1 || true)
if echo "$STATUS" | grep -qi "logged out\|stopped"; then
echo "Tailscale is not authenticated. Logging in..."
sudo tailscale up --accept-routes --auth-key="$TS_AUTH_KEY"
echo "Tailscale login complete."
else
echo "Tailscale is already authenticated, skipping."
fi