153 lines
3.7 KiB
Bash
Executable File
153 lines
3.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Rekordbox Sync .env Setup Script
|
|
|
|
echo "🔧 Setting up Rekordbox Sync .env configuration file..."
|
|
|
|
# Check if .env already exists
|
|
if [ -f ".env" ]; then
|
|
echo "⚠️ .env file already exists!"
|
|
read -p "Do you want to overwrite it? (y/N): " -n 1 -r
|
|
echo
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "❌ Setup cancelled."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Get S3 configuration
|
|
echo ""
|
|
echo "🌐 S3 Configuration:"
|
|
read -p "S3 Endpoint (default: https://garage.geertrademakers.nl): " s3_endpoint
|
|
s3_endpoint=${s3_endpoint:-https://garage.geertrademakers.nl}
|
|
|
|
read -p "S3 Region (default: garage): " s3_region
|
|
s3_region=${s3_region:-garage}
|
|
|
|
read -p "S3 Access Key ID: " s3_access_key
|
|
if [ -z "$s3_access_key" ]; then
|
|
echo "❌ S3 Access Key ID is required!"
|
|
exit 1
|
|
fi
|
|
|
|
read -s -p "S3 Secret Access Key: " s3_secret_key
|
|
echo
|
|
if [ -z "$s3_secret_key" ]; then
|
|
echo "❌ S3 Secret Access Key is required!"
|
|
exit 1
|
|
fi
|
|
|
|
read -p "S3 Bucket Name (default: music): " s3_bucket
|
|
s3_bucket=${s3_bucket:-music}
|
|
|
|
read -p "Use SSL? (Y/n): " -n 1 -r
|
|
echo
|
|
s3_use_ssl="true"
|
|
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
|
s3_use_ssl="false"
|
|
fi
|
|
|
|
# Get sync configuration
|
|
echo ""
|
|
echo "🔄 Sync Configuration:"
|
|
read -p "Local Music Folder Path: " sync_local_path
|
|
if [ -z "$sync_local_path" ]; then
|
|
echo "❌ Local music folder path is required!"
|
|
exit 1
|
|
fi
|
|
|
|
read -p "Sync Interval in seconds (default: 30): " sync_interval
|
|
sync_interval=${sync_interval:-30}
|
|
sync_interval=$((sync_interval * 1000)) # Convert to milliseconds
|
|
|
|
read -p "Auto-start sync on app launch? (y/N): " -n 1 -r
|
|
echo
|
|
sync_auto_start="false"
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
sync_auto_start="true"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Conflict Resolution Strategy:"
|
|
echo "1) newer-wins (recommended)"
|
|
echo "2) local-wins"
|
|
echo "3) remote-wins"
|
|
read -p "Choose strategy (1-3, default: 1): " conflict_resolution
|
|
case $conflict_resolution in
|
|
2) conflict_resolution="local-wins" ;;
|
|
3) conflict_resolution="remote-wins" ;;
|
|
*) conflict_resolution="newer-wins" ;;
|
|
esac
|
|
|
|
# Get UI configuration
|
|
echo ""
|
|
echo "🎨 UI Configuration:"
|
|
echo "Theme options:"
|
|
echo "1) system (follows OS theme)"
|
|
echo "2) light"
|
|
echo "3) dark"
|
|
read -p "Choose theme (1-3, default: 1): " ui_theme
|
|
case $ui_theme in
|
|
2) ui_theme="light" ;;
|
|
3) ui_theme="dark" ;;
|
|
*) ui_theme="system" ;;
|
|
esac
|
|
|
|
read -p "Show notifications? (Y/n): " -n 1 -r
|
|
echo
|
|
ui_notifications="true"
|
|
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
|
ui_notifications="false"
|
|
fi
|
|
|
|
read -p "Minimize to system tray? (Y/n): " -n 1 -r
|
|
echo
|
|
ui_minimize_to_tray="true"
|
|
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
|
ui_minimize_to_tray="false"
|
|
fi
|
|
|
|
# Create .env file
|
|
echo ""
|
|
echo "📝 Creating .env file..."
|
|
|
|
cat > .env << EOF
|
|
# Rekordbox Sync Desktop Application Configuration
|
|
# Generated on $(date)
|
|
|
|
# S3 Configuration
|
|
S3_ENDPOINT=$s3_endpoint
|
|
S3_REGION=$s3_region
|
|
S3_ACCESS_KEY_ID=$s3_access_key
|
|
S3_SECRET_ACCESS_KEY=$s3_secret_key
|
|
S3_BUCKET_NAME=$s3_bucket
|
|
S3_USE_SSL=$s3_use_ssl
|
|
|
|
# Sync Configuration
|
|
SYNC_LOCAL_PATH=$sync_local_path
|
|
SYNC_INTERVAL=$sync_interval
|
|
SYNC_AUTO_START=$sync_auto_start
|
|
SYNC_CONFLICT_RESOLUTION=$conflict_resolution
|
|
|
|
# UI Configuration
|
|
UI_THEME=$ui_theme
|
|
UI_LANGUAGE=en
|
|
UI_NOTIFICATIONS=$ui_notifications
|
|
UI_MINIMIZE_TO_TRAY=$ui_minimize_to_tray
|
|
EOF
|
|
|
|
echo "✅ .env file created successfully!"
|
|
echo ""
|
|
echo "🔍 Configuration summary:"
|
|
echo " S3 Endpoint: $s3_endpoint"
|
|
echo " S3 Region: $s3_region"
|
|
echo " S3 Bucket: $s3_bucket"
|
|
echo " Local Path: $sync_local_path"
|
|
echo " Sync Interval: $((sync_interval / 1000)) seconds"
|
|
echo " Auto-start: $sync_auto_start"
|
|
echo " Conflict Resolution: $conflict_resolution"
|
|
echo " Theme: $ui_theme"
|
|
echo ""
|
|
echo "🚀 You can now start the application with: npm run dev"
|
|
echo "📖 The .env file will be automatically loaded on startup."
|