-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·74 lines (61 loc) · 2.37 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·74 lines (61 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# AOL Chat Room Setup Script
echo "🚀 Setting up AOL Chat Room..."
# Check if .env exists
if [ ! -f ".env" ]; then
echo "📝 Creating .env file from template..."
cp .env.example .env
# Generate a random JWT secret
JWT_SECRET=$(openssl rand -base64 64 | tr -d "=+/" | cut -c1-64)
# Replace the default JWT secret in .env
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' "s/your-super-secret-jwt-key-change-this-in-production/${JWT_SECRET}/g" .env
else
# Linux
sed -i "s/your-super-secret-jwt-key-change-this-in-production/${JWT_SECRET}/g" .env
fi
echo "✅ Generated secure JWT secret"
else
echo "⚠️ .env file already exists, skipping..."
fi
# Check if Docker is installed
if command -v docker &> /dev/null && command -v docker-compose &> /dev/null; then
echo "🐳 Docker detected, you can run with: docker-compose up --build"
elif command -v docker &> /dev/null && docker compose version &> /dev/null; then
echo "🐳 Docker detected, you can run with: docker compose up --build"
else
echo "📦 Docker not detected, setting up for local development..."
# Check if Node.js is installed
if command -v node &> /dev/null; then
NODE_VERSION=$(node --version)
echo "✅ Node.js detected: $NODE_VERSION"
# Install server dependencies
if [ -d "server" ]; then
echo "📦 Installing server dependencies..."
cd server && npm install && cd ..
fi
# Install client dependencies
if [ -d "client" ]; then
echo "📦 Installing client dependencies..."
cd client && npm install && cd ..
fi
echo "🎉 Setup complete!"
echo ""
echo "To start the application:"
echo " 1. Start the server: cd server && npm run dev"
echo " 2. Start the client: cd client && npm run dev"
echo " 3. Open http://localhost:3001 in your browser"
else
echo "❌ Node.js not detected. Please install Node.js 18+ first."
echo " Visit: https://nodejs.org/"
exit 1
fi
fi
echo ""
echo "🎮 AOL Chat Room is ready!"
echo "📖 Check the README.md for more information."
# Make the first user admin hint
echo ""
echo "💡 Tip: The first user to register will become the admin automatically!"
echo "🔧 You can modify settings in the .env file"