Add .sync-credentials file support for testing
This commit is contained in:
@@ -24,10 +24,15 @@ 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 ""
|
||||||
|
|
||||||
|
# Check if config is predefined (for testing usually)
|
||||||
|
if [ -f ".sync-credentials" ]; then
|
||||||
|
source ".sync-credentials"
|
||||||
|
else
|
||||||
# Prompt for configuration
|
# Prompt for configuration
|
||||||
read -p "Server user@host (e.g., leo@server.com): " SERVER_HOST
|
read -p "Server user@host (e.g., leo@server.com): " SERVER_HOST
|
||||||
read -p "Server project path (e.g., /home/leo/public_leo): " SERVER_PROJECT_PATH
|
read -p "Server project path (e.g., /home/leo/public_leo): " SERVER_PROJECT_PATH
|
||||||
@@ -35,9 +40,25 @@ read -p "Local folder path (e.g., Delta Pharmacy): " LOCAL_FOLDER
|
|||||||
read -sp "SSH Password: " SSH_PASSWORD
|
read -sp "SSH Password: " SSH_PASSWORD
|
||||||
echo ""
|
echo ""
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user