71 lines
3.2 KiB
PowerShell
71 lines
3.2 KiB
PowerShell
# ═══════════════════════════════════════════════════════════════════════════
|
|
# EmailSorter - Appwrite Setup Script
|
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
#
|
|
# ⚠️ WICHTIG: Diese Datei ist VERALTET!
|
|
#
|
|
# Verwende stattdessen:
|
|
# cd server
|
|
# npm run bootstrap:v2
|
|
#
|
|
# Oder setze die Umgebungsvariablen in server/.env und führe dann aus:
|
|
# cd server
|
|
# node bootstrap-v2.mjs
|
|
#
|
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
|
|
Write-Host "`n⚠️ WARNUNG: Diese Datei ist veraltet!" -ForegroundColor Yellow
|
|
Write-Host "`nBitte verwende stattdessen:" -ForegroundColor White
|
|
Write-Host " 1. Erstelle server/.env mit deinen Appwrite Credentials" -ForegroundColor Gray
|
|
Write-Host " 2. Führe aus: cd server && npm run bootstrap:v2" -ForegroundColor Gray
|
|
Write-Host "`nSiehe APPWRITE_SETUP.md für Details." -ForegroundColor Cyan
|
|
Write-Host "`n"
|
|
|
|
# -----------------------------
|
|
# CONFIG (NUR FALLS .env NICHT VORHANDEN)
|
|
# -----------------------------
|
|
# ⚠️ KEINE HARDCODED API KEYS MEHR!
|
|
# Lese aus server/.env oder setze als Umgebungsvariablen
|
|
|
|
if (-not (Test-Path ".\server\.env")) {
|
|
Write-Host "❌ Keine server/.env Datei gefunden!" -ForegroundColor Red
|
|
Write-Host "`nBitte erstelle server/.env mit:" -ForegroundColor Yellow
|
|
Write-Host " APPWRITE_ENDPOINT=https://appwrite.webklar.com/v1" -ForegroundColor Gray
|
|
Write-Host " APPWRITE_PROJECT_ID=deine_projekt_id" -ForegroundColor Gray
|
|
Write-Host " APPWRITE_API_KEY=dein_api_key" -ForegroundColor Gray
|
|
Write-Host " APPWRITE_DATABASE_ID=emailsorter" -ForegroundColor Gray
|
|
Write-Host "`nSiehe server/env.example für ein Template." -ForegroundColor Cyan
|
|
exit 1
|
|
}
|
|
|
|
# -----------------------------
|
|
# RUN
|
|
# -----------------------------
|
|
if (-not (Test-Path ".\server")) {
|
|
New-Item -ItemType Directory -Path ".\server" | Out-Null
|
|
}
|
|
|
|
Set-Location ".\server"
|
|
|
|
# Prüfe ob package.json existiert
|
|
if (-not (Test-Path "package.json")) {
|
|
Write-Host "❌ server/package.json nicht gefunden!" -ForegroundColor Red
|
|
Write-Host "Bitte führe zuerst 'npm install' im server Ordner aus." -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "`n=== EmailSorter Bootstrap ===" -ForegroundColor Cyan
|
|
Write-Host "Verwende bootstrap-v2.mjs (aktuelle Version)" -ForegroundColor Green
|
|
Write-Host ""
|
|
|
|
# Verwende bootstrap-v2.mjs (aktuelle Version)
|
|
node bootstrap-v2.mjs
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "`n✅ Bootstrap erfolgreich abgeschlossen!" -ForegroundColor Green
|
|
Write-Host "`nDie Datenbank und alle Collections wurden erstellt." -ForegroundColor White
|
|
} else {
|
|
Write-Host "`n❌ Fehler beim Bootstrap." -ForegroundColor Red
|
|
Write-Host "Prüfe die Fehlermeldungen oben." -ForegroundColor Yellow
|
|
}
|