feat: Update frontend and backend configurations for development environment - Downgrade PyP100 version in requirements.txt for compatibility. - Add new frontend routes for index, login, dashboard, printers, jobs, and profile pages. - Modify docker-compose files for development setup, including environment variables and service names. - Update Caddyfile for local development with Raspberry Pi backend. - Adjust health check route to use updated backend URL. - Enhance setup-backend-url.sh for development environment configuration. """
80 lines
2.3 KiB
Bash
Executable File
80 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Skript zum Setzen der Backend-URL in der Frontend-Konfiguration
|
|
# Entwicklungsumgebung - Raspberry Pi Backend auf 192.168.0.105:5000
|
|
|
|
# Farbcodes für Ausgabe
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[0;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Funktion zur Ausgabe mit Zeitstempel
|
|
log() {
|
|
echo -e "${BLUE}[$(date +'%Y-%m-%d %H:%M:%S')]${NC} $1"
|
|
}
|
|
|
|
error_log() {
|
|
echo -e "${RED}[$(date +'%Y-%m-%d %H:%M:%S')] FEHLER:${NC} $1" >&2
|
|
}
|
|
|
|
# Definiere Variablen
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
ENV_FILE="$SCRIPT_DIR/.env.local"
|
|
# Hardcoded für Entwicklungsumgebung - Raspberry Pi Backend
|
|
BACKEND_URL="http://192.168.0.105:5000"
|
|
|
|
log "Entwicklungsumgebung - Raspberry Pi Backend: ${BACKEND_URL}"
|
|
|
|
# Hostname für OAuth (Entwicklung)
|
|
FRONTEND_HOSTNAME="localhost"
|
|
OAUTH_URL="http://localhost:3000/auth/login/callback"
|
|
log "Frontend-Hostname (Entwicklung): $FRONTEND_HOSTNAME"
|
|
|
|
# Erstelle .env.local Datei mit Backend-URL
|
|
log "${YELLOW}Erstelle .env.local Datei für Entwicklungsumgebung...${NC}"
|
|
cat > "$ENV_FILE" << EOL
|
|
# Backend API Konfiguration - Raspberry Pi (Entwicklung)
|
|
NEXT_PUBLIC_API_URL=${BACKEND_URL}
|
|
|
|
# Frontend-URL für OAuth Callback (Entwicklung)
|
|
NEXT_PUBLIC_FRONTEND_URL=http://${FRONTEND_HOSTNAME}:3000
|
|
|
|
# Explizite OAuth Callback URL für GitHub (Entwicklung)
|
|
NEXT_PUBLIC_OAUTH_CALLBACK_URL=${OAUTH_URL}
|
|
|
|
# Entwicklungsumgebung
|
|
NODE_ENV=development
|
|
DEBUG=true
|
|
NEXT_DEBUG=true
|
|
|
|
# OAuth Konfiguration (Entwicklung)
|
|
OAUTH_CLIENT_ID=dev_client_id
|
|
OAUTH_CLIENT_SECRET=dev_client_secret
|
|
|
|
# Raspberry Pi Backend Host
|
|
NEXT_PUBLIC_BACKEND_HOST=192.168.0.105:5000
|
|
EOL
|
|
|
|
# Überprüfe, ob die Datei erstellt wurde
|
|
if [ -f "$ENV_FILE" ]; then
|
|
log "${GREEN}Erfolgreich .env.local Datei für Entwicklungsumgebung erstellt: ${BACKEND_URL}${NC}"
|
|
else
|
|
error_log "Konnte .env.local Datei nicht erstellen."
|
|
exit 1
|
|
fi
|
|
|
|
# Hinweis für Entwicklungsumgebung
|
|
log "${YELLOW}ENTWICKLUNGSUMGEBUNG KONFIGURIERT:${NC}"
|
|
log "Backend (Raspberry Pi): ${BACKEND_URL}"
|
|
log "Frontend: http://localhost:3000"
|
|
log "OAuth Callback: ${OAUTH_URL}"
|
|
log ""
|
|
log "${GREEN}Backend-URL wurde erfolgreich für die Entwicklungsumgebung konfiguriert.${NC}"
|
|
log "${GREEN}Das Frontend verbindet sich jetzt mit dem Raspberry Pi Backend.${NC}"
|
|
|
|
# Berechtigungen setzen
|
|
chmod 600 "$ENV_FILE"
|
|
|
|
exit 0 |