Browse Source

fix: server.json handling

Stefan Stidl 4 months ago
parent
commit
debd40b4f7
3 changed files with 5 additions and 6 deletions
  1. 0 2
      Dockerfile
  2. 0 2
      Dockerfile.alpine
  3. 5 2
      docker/entrypoint.sh

+ 0 - 2
Dockerfile

@@ -27,8 +27,6 @@ COPY index-modern.html /speedtest/
 COPY config.json /speedtest/
 COPY favicon.ico /speedtest/
 
-COPY docker/servers.json /servers.json
-
 COPY docker/*.php /speedtest/
 COPY docker/entrypoint.sh /
 

+ 0 - 2
Dockerfile.alpine

@@ -41,8 +41,6 @@ COPY index-modern.html /speedtest/
 COPY config.json /speedtest/
 COPY favicon.ico /speedtest/
 
-COPY docker/servers.json /servers.json
-
 COPY docker/*.php /speedtest/
 COPY docker/entrypoint.sh /
 

+ 5 - 2
docker/entrypoint.sh

@@ -69,8 +69,11 @@ if [[ "$MODE" == "frontend" || "$MODE" == "dual" ||  "$MODE" == "standalone" ]];
   
   # Copy frontend config files
   cp /speedtest/frontend/settings.json /var/www/html/settings.json 2>/dev/null || true
-  if [ ! -f /var/www/html/server-list.json ]; then
-    echo "no server-list.json found, create one for local host"
+  if [ -f /servers.json ]; then
+    echo "using mounted /servers.json for server-list.json"
+    cp /servers.json /var/www/html/server-list.json
+  else
+    echo "no /servers.json found, create one for local host"
     # generate config for just the local server
     echo '[{"name":"local","server":"/backend",  "dlURL": "garbage.php", "ulURL": "empty.php", "pingURL": "empty.php", "getIpURL": "getIP.php", "sponsorName": "", "sponsorURL": "", "id":1 }]' > /var/www/html/server-list.json
   fi