Start scripts (PS1 + Shell), Dockerfile, E2E sync tests, and README documentation for Phase 2 LAN server deployment. New files: - start-server.ps1 / start-server.sh: one-command server startup with auto-build, LAN-IP detection, and configurable API key - Dockerfile: multi-stage build (Gradle → JRE Alpine) for container deployment with volume mount for persistent data - .dockerignore: excludes app/, .git, build artifacts from Docker context - EndToEndSyncTest.kt: 7 E2E tests covering full push/pull sync cycle, multi-client overwrite, empty DB pull, multiple round-trips, and auth rejection for unauthenticated requests - README.md: project overview, build instructions, and complete Phase 2 server setup docs (4 start options, LAN setup, API reference, security) Changed files: - AndroidManifest.xml: added usesCleartextTraffic=true for HTTP in LAN Closes #46
54 lines
1.7 KiB
PowerShell
54 lines
1.7 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Startet den Krisenvorrat Dev-Server im LAN.
|
|
.DESCRIPTION
|
|
Baut das Fat-JAR (falls nötig) und startet den Server auf Port 8080.
|
|
Der Server ist unter der LAN-IP des Rechners erreichbar.
|
|
.PARAMETER Build
|
|
Erzwingt einen Neubau des Fat-JARs, auch wenn es bereits existiert.
|
|
.PARAMETER ApiKey
|
|
Setzt einen benutzerdefinierten API-Key. Standard: "dev-api-key-change-in-production"
|
|
.EXAMPLE
|
|
.\start-server.ps1
|
|
.\start-server.ps1 -Build
|
|
.\start-server.ps1 -ApiKey "mein-geheimer-key"
|
|
#>
|
|
param(
|
|
[switch]$Build,
|
|
[string]$ApiKey = "dev-api-key-change-in-production"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
Set-Location $PSScriptRoot
|
|
|
|
$jarPath = "server/build/libs/server.jar"
|
|
|
|
# Fat-JAR bauen falls nötig
|
|
if ($Build -or -not (Test-Path $jarPath)) {
|
|
Write-Host "Building server fat JAR..." -ForegroundColor Cyan
|
|
& .\gradlew.bat :server:buildFatJar 2>&1 | Out-String | Write-Host
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Error "Build failed with exit code $LASTEXITCODE"
|
|
exit 1
|
|
}
|
|
Write-Host "Build successful." -ForegroundColor Green
|
|
}
|
|
|
|
# LAN-IP ermitteln
|
|
$lanIp = (Get-NetIPAddress -AddressFamily IPv4 |
|
|
Where-Object { $_.InterfaceAlias -notmatch "Loopback" -and $_.IPAddress -notmatch "^169\." } |
|
|
Select-Object -First 1).IPAddress
|
|
|
|
Write-Host ""
|
|
Write-Host "=== Krisenvorrat Dev-Server ===" -ForegroundColor Green
|
|
Write-Host "Local: http://localhost:8080" -ForegroundColor Yellow
|
|
if ($lanIp) {
|
|
Write-Host "LAN: http://${lanIp}:8080" -ForegroundColor Yellow
|
|
}
|
|
Write-Host "API-Key: $ApiKey" -ForegroundColor Yellow
|
|
Write-Host "Press Ctrl+C to stop" -ForegroundColor Gray
|
|
Write-Host ""
|
|
|
|
# Server starten
|
|
$env:KRISENVORRAT_API_KEY = $ApiKey
|
|
java -jar $jarPath
|