-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_ngrok.sh
executable file
·33 lines (23 loc) · 1.01 KB
/
run_ngrok.sh
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
#!/bin/bash
echo "Starting Ngrok..."
# Run Ngrok
./ngrok/ngrok start -config ngrok_config.yml game_server room_server > /dev/null &
# Wait for Ngrok to start
sleep 2
echo "Fetching Ngrok tunnels..."
# Get info about Ngrok tunnels
python3 get_ngrok_tunnels.py
# Add environment variables with server names
. ./ngrok_tunnels.txt
echo "Updating configs with Ngrok tunnels..."
# Generate config for the room server
sed 's@<hostname>@'"$GAME_SERVER"'@' ./room_server/server/config.js.nodata > ./room_server/server/config.js
sed -i 's@LOCAL = true@LOCAL = false@' ./room_server/server/config.js
# Generate config for the game server
sed 's@<server_name>@'"$GAME_SERVER"'@' ./game_server/nginx.conf.nodata > ./game_server/nginx.conf
sed 's@<server_name>@'"$ROOM_SERVER"'@' ./game_server/game_files/scripts/server_config.js.nodata > ./game_server/game_files/scripts/server_config.js
sed -i 's@LOCAL = true@LOCAL = false@' ./game_server/game_files/scripts/server_config.js
# Cleanup
rm tunnels.json
rm ngrok_tunnels.txt
echo "Done"