Browse Source

add port selection

Josh Bicking 7 years ago
parent
commit
3f611bc1e3
3 changed files with 10 additions and 4 deletions
  1. 2 0
      Dockerfile
  2. 4 2
      README.md
  3. 4 2
      start.sh

+ 2 - 0
Dockerfile

@@ -7,4 +7,6 @@ ADD start.sh /start.sh
 CMD chmod +x /start.sh
 EXPOSE 3000 9000
 ENV HOST=localhost
+ENV PEERJSPORT=9000
+ENV HTTPPORT=3000
 CMD su -c "export HOST=$HOST && /start.sh"

+ 4 - 2
README.md

@@ -10,10 +10,12 @@ Building:
 
 Running:
 
-    docker run -p 3000:3000 -p 9000:9000 \
+    docker run \
+    -p 3000:3000 -e "HTTPPORT=3000" \
+    -p 9000:9000 -e "PEERJSPORT=9000" \
     --name=sendd \
     -e "HOST=`curl ipv4.icanhazip.com`" \
     -d \
     sendd-docker
 
-Connect to the server (by default) at port 3000. Port 9000 must also be open for the peer server to communicate with clients.
+Connect to the server at HTTPPORT (default port 3000). PEERJSPORT (port 9000) must also be open for the peer server to communicate with clients.

+ 4 - 2
start.sh

@@ -1,10 +1,12 @@
 #!/bin/bash
 
-sed "s/localhost/$HOST/" /sendd/public/javascripts/index-localhost.js > /sendd/public/javascripts/index.js
+sed -i "s/localhost/$HOST/" /sendd/public/javascripts/index.js
+sed -i "s/9000/$PEERJSPORT/" /sendd/public/javascripts/index.js
+sed -i "s/9000/$PEERJSPORT/" /sendd/routes/index.js
 
 cd /sendd
 
 ln -s /usr/bin/nodejs /usr/bin/node 
 
 npm install
-npm start
+PORT=$HTTPPORT npm start