Files
AdsPreview/deployment/scripts/upload.sh
Johannes b4758b4f26 security: clean repository without media files and sensitive data
- Removed area/ directory with 816MB of media files
- Removed sensitive FTP credentials from Git history
- Implemented .env.upload system for secure deployments
- Added comprehensive .gitignore for future protection

This commit represents a clean slate with all sensitive data removed.
2025-09-07 11:05:29 +02:00

91 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
# Upload-Skript für Webspace Deployment
echo "📤 Webspace Upload Skript"
echo ""
# Konfiguration aus .env.upload Datei laden
ENV_FILE="$(dirname "$0")/.env.upload"
if [ ! -f "$ENV_FILE" ]; then
echo "❌ Konfigurationsdatei nicht gefunden: $ENV_FILE"
echo ""
echo "📋 ERSTELLE EINE .env.upload DATEI:"
echo " 1. Kopiere .env.upload.example zu .env.upload"
echo " 2. Trage deine FTP-Zugangsdaten ein"
echo ""
echo " Beispiel:"
echo " FTP_HOST=\"dein-server.de\""
echo " FTP_USER=\"dein-username\""
echo " FTP_PASS=\"dein-passwort\""
echo " FTP_PATH=\"/htdocs\""
exit 1
fi
# Environment-Variablen aus .env.upload laden
set -a # Export aller Variablen
source "$ENV_FILE"
set +a
echo "🔧 KONFIGURATION:"
echo " Host: $FTP_HOST"
echo " User: $FTP_USER"
echo " Path: $FTP_PATH"
echo ""
# Prüfe ob wir im deployment/scripts/ Ordner sind und wechsle zur Projekt-Root
if [ "$(basename "$PWD")" = "scripts" ]; then
cd ../..
elif [ "$(basename "$PWD")" = "deployment" ]; then
cd ..
fi
# Überprüfe ob deployment/build Ordner existiert
if [ ! -d "deployment/build" ]; then
echo "❌ deployment/build/ Ordner nicht gefunden."
echo " Führe zuerst das deploy.sh Skript aus!"
exit 1
fi
# Überprüfe ob lftp installiert ist
if ! command -v lftp &> /dev/null; then
echo "❌ lftp ist nicht installiert."
echo " Installation: brew install lftp"
echo ""
echo "📋 MANUELLE UPLOAD-ANLEITUNG:"
echo " 1. Öffne deinen FTP Client (FileZilla, etc.)"
echo " 2. Verbinde zu deinem Webspace"
echo " 3. Navigiere zu htdocs/ oder public_html/"
echo " 4. Uploade alle Dateien aus: deployment/build/"
echo ""
exit 1
fi
echo "⚠️ ACHTUNG: Dies überschreibt alle Dateien auf dem Webspace!"
echo " Fortfahren? (y/N)"
read -r response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
echo "Abgebrochen."
exit 0
fi
echo "📤 Uploade via SFTP..."
lftp -c "
set sftp:auto-confirm yes;
set ssl:verify-certificate no;
open sftp://$FTP_USER:$FTP_PASS@$FTP_HOST;
cd $FTP_PATH;
lcd deployment/build;
mirror --reverse --delete --verbose --exclude-glob=node_modules/ --exclude-glob=.git/ --exclude-glob=.* --exclude area/ ./ ./;
bye
"
if [ $? -eq 0 ]; then
echo "✅ Upload erfolgreich!"
echo "🌐 Deine App sollte jetzt live sein!"
else
echo "❌ Upload fehlgeschlagen. Prüfe deine FTP-Zugangsdaten."
fi