Add .sync-credentials file support for testing

This commit is contained in:
2025-12-04 13:30:00 +02:00
parent 7cd115b764
commit 7db65514be

View File

@@ -24,20 +24,41 @@ NC='\033[0m' # No Color
# Get current script real directory (follow symlinks) # Get current script real directory (follow symlinks)
SCRIPT_PATH="$(realpath "$0")" SCRIPT_PATH="$(realpath "$0")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
ARCHIVE_NAME="leo.tar.gz"
echo -e "${BLUE}=== Project Sync Configuration ===${NC}" echo -e "${BLUE}=== Project Sync Configuration ===${NC}"
echo "" echo ""
# Prompt for configuration # Check if config is predefined (for testing usually)
read -p "Server user@host (e.g., leo@server.com): " SERVER_HOST if [ -f ".sync-credentials" ]; then
read -p "Server project path (e.g., /home/leo/public_leo): " SERVER_PROJECT_PATH source ".sync-credentials"
read -p "Local folder path (e.g., Delta Pharmacy): " LOCAL_FOLDER else
read -sp "SSH Password: " SSH_PASSWORD # Prompt for configuration
echo "" read -p "Server user@host (e.g., leo@server.com): " SERVER_HOST
echo "" read -p "Server project path (e.g., /home/leo/public_leo): " SERVER_PROJECT_PATH
read -p "Local folder path (e.g., Delta Pharmacy): " LOCAL_FOLDER
read -sp "SSH Password: " SSH_PASSWORD
echo ""
echo ""
fi
ARCHIVE_NAME="leo.tar.gz" # Validate required variables (all except password)
if [ -z "$SERVER_HOST" ]; then
echo -e "${RED}Error: SERVER_HOST is not set${NC}"
exit 1
fi
if [ -z "$SERVER_PROJECT_PATH" ]; then
echo -e "${RED}Error: SERVER_PROJECT_PATH is not set${NC}"
exit 1
fi
if [ -z "$LOCAL_FOLDER" ]; then
echo -e "${RED}Error: LOCAL_FOLDER is not set${NC}"
exit 1
fi
# Start sync process
echo "Starting project sync..." echo "Starting project sync..."
# Step 1: SSH into server and create tar archive # Step 1: SSH into server and create tar archive