test
This commit is contained in:
@@ -66,7 +66,7 @@ require_var() {
|
||||
fi
|
||||
}
|
||||
|
||||
# 🔥 Host + SSH Detection (THE IMPORTANT FIX)
|
||||
# Detect hosts + SSH key + Tailscale IP
|
||||
detect_hosts() {
|
||||
LOCAL_HOSTNAME="$(hostname)"
|
||||
|
||||
@@ -86,13 +86,24 @@ detect_hosts() {
|
||||
|
||||
# Resolve Tailscale IP
|
||||
REMOTE_SERVER=$(tailscale ip -4 "$REMOTE_SERVER_NAME" 2>/dev/null)
|
||||
|
||||
if [[ -z "$REMOTE_SERVER" ]]; then
|
||||
echo "Error: Could not resolve Tailscale IP for $REMOTE_SERVER_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Assign SSH key
|
||||
# Validate SSH_KEYS
|
||||
if [[ "$(declare -p SSH_KEYS 2>/dev/null)" != declare\ -A* ]]; then
|
||||
echo "Error: SSH_KEYS is not a valid associative array."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KEY_ID="$LOCAL_SERVER_NAME|$REMOTE_SERVER_NAME"
|
||||
|
||||
# Debug (safe to keep)
|
||||
echo "DEBUG: KEY_ID=$KEY_ID"
|
||||
echo "DEBUG: Available keys: ${!SSH_KEYS[@]}"
|
||||
|
||||
if [[ -n "${SSH_KEYS[$KEY_ID]}" ]]; then
|
||||
SSH_KEY="${SSH_KEYS[$KEY_ID]}"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user