- Change default port to 4001 across all configuration files (server.js, docker-compose.yml, .env, Dockerfile) - Update frontend API URL to use new port 4001 - Fix circular dependency issues in route files by using process.env.SERVER_DIR instead of importing from server.js - Apply to all routes: auth.js, backup.js, logs.js, players.js, rcon.js, server.js, whitelist.js - Fix environment variable loading in start.sh to properly handle paths with spaces - Quote SERVER_DIR path in .env to preserve spaces in directory paths - Update all documentation references from port 3000 to 4001 (README, QUICKSTART, CONFIGURATION, INDEX) - Remove debug console.log statements from auth.js - Remove test utility file test-ops.js Fixes: Port conflict issues, circular dependency warnings, environment variable parsing
40 lines
942 B
Bash
Executable File
40 lines
942 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script de démarrage pour le serveur et l'interface web
|
|
# =========================================================
|
|
|
|
# Couleurs
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
echo -e "${GREEN}🎮 NationsGlory Admin Panel - Démarrage${NC}"
|
|
echo ""
|
|
|
|
# Vérifier que le backend existe
|
|
if [ ! -d "backend" ]; then
|
|
echo -e "${RED}❌ Dossier backend non trouvé!${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Vérifier le fichier .env
|
|
if [ ! -f "backend/.env" ]; then
|
|
echo -e "${RED}❌ Fichier backend/.env non trouvé!${NC}"
|
|
echo -e "${YELLOW}Copiez d'abord: cp backend/.env.example backend/.env${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Charger les variables d'environnement
|
|
source backend/.env
|
|
|
|
echo -e "${GREEN}✓ Variables d'environnement chargées${NC}"
|
|
echo " - Port: $PORT"
|
|
echo " - Serveur MC: $SERVER_DIR"
|
|
echo ""
|
|
|
|
# Démarrer le backend
|
|
echo -e "${YELLOW}⏳ Démarrage du backend...${NC}"
|
|
cd backend
|
|
npm start
|