-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-env.sh
More file actions
executable file
·42 lines (38 loc) · 1.18 KB
/
Copy pathinit-env.sh
File metadata and controls
executable file
·42 lines (38 loc) · 1.18 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
#!/bin/bash
echo "=================================================="
echo "Initializing environment files for ChitChat..."
echo "=================================================="
# Server setup
if [ -d "server" ]; then
echo "Processing server environment..."
if [ ! -f "server/.env" ]; then
if [ -f "server/.env.example" ]; then
cp "server/.env.example" "server/.env"
echo " ✔ Created server/.env from server/.env.example"
else
cat <<EOT > server/.env
PORT=3000
MONGODB_URI=mongodb://localhost:27017/chitchat
JWT_SECRET=chitchat_jwt_secret_key_change_in_production
EOT
echo " ✔ Generated server/.env file"
fi
else
echo " ℹ server/.env already exists."
fi
fi
# Client setup
if [ -d "client" ]; then
echo "Processing client environment..."
if [ ! -f "client/.env" ]; then
cat <<EOT > client/.env
NUXT_PUBLIC_API_BASE=http://localhost:3000
NUXT_PUBLIC_SOCKET_URL=http://localhost:3000
EOT
echo " ✔ Generated client/.env file"
else
echo " ℹ client/.env already exists."
fi
fi
echo "--------------------------------------------------"
echo "Environment initialization complete! Run 'docker compose up -d --build' to start."