70 lines
2.3 KiB
Bash
Executable File
70 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# DOCX Template Server Startup Script
|
|
|
|
case "$1" in
|
|
"http")
|
|
echo "🌐 Starte Server nur mit HTTP..."
|
|
unset USE_HTTPS
|
|
node server.js
|
|
;;
|
|
"https")
|
|
echo "🔒 Starte Server mit HTTPS (Port 3443)..."
|
|
export USE_HTTPS=true
|
|
node server.js
|
|
;;
|
|
"both")
|
|
echo "🚀 Starte Server mit HTTP und HTTPS..."
|
|
node server.js
|
|
;;
|
|
"dev")
|
|
echo "🛠️ Entwicklungsmodus mit Auto-Reload..."
|
|
npx nodemon server.js
|
|
;;
|
|
"ssl-gen")
|
|
echo "🔐 Generiere neue SSL-Zertifikate..."
|
|
mkdir -p ssl
|
|
cd ssl
|
|
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes \
|
|
-subj "/C=DE/ST=State/L=City/O=DOCX-Server/CN=localhost"
|
|
echo "✅ SSL-Zertifikate erstellt in ssl/"
|
|
;;
|
|
"ssl-info")
|
|
echo "📋 SSL-Zertifikat Informationen:"
|
|
if [ -f "ssl/cert.pem" ]; then
|
|
openssl x509 -in ssl/cert.pem -text -noout | grep -E "(Subject:|Not Before|Not After|DNS:|IP Address:)"
|
|
else
|
|
echo "❌ Keine SSL-Zertifikate gefunden"
|
|
echo "Führe './start.sh ssl-gen' aus, um Zertifikate zu erstellen"
|
|
fi
|
|
;;
|
|
"help"|"--help"|"-h"|"")
|
|
echo "DOCX Template Server - Startup Script"
|
|
echo ""
|
|
echo "Verwendung: $0 [MODUS]"
|
|
echo ""
|
|
echo "Modi:"
|
|
echo " http - Nur HTTP Server (Port 3000)"
|
|
echo " https - Nur HTTPS Server (Port 3443) - benötigt SSL-Zertifikate"
|
|
echo " both - HTTP + HTTPS Server (Standard)"
|
|
echo " dev - Entwicklungsmodus mit Auto-Reload"
|
|
echo " ssl-gen - Generiere neue SSL-Zertifikate"
|
|
echo " ssl-info - Zeige SSL-Zertifikat Informationen"
|
|
echo " help - Diese Hilfe anzeigen"
|
|
echo ""
|
|
echo "Beispiele:"
|
|
echo " $0 both # HTTP + HTTPS"
|
|
echo " $0 https # Nur HTTPS"
|
|
echo " $0 ssl-gen # SSL-Zertifikate erstellen"
|
|
echo ""
|
|
echo "URLs:"
|
|
echo " HTTP: http://localhost:3000"
|
|
echo " HTTPS: https://localhost:3443"
|
|
echo " WebDAV: /webdav/templates/ und /webdav/output/"
|
|
;;
|
|
*)
|
|
echo "❌ Unbekannter Modus: $1"
|
|
echo "Verwende '$0 help' für Hilfe"
|
|
exit 1
|
|
;;
|
|
esac |