Browse Source

[+Jordi] #163 - Update go.sh and readme to accomodate running petition-app on external devices

Elena Cristina Raffay Iglesias 1 year ago
parent
commit
965cb7e1e2
2 changed files with 15 additions and 0 deletions
  1. 6 0
      apps/petitions/petitions-app/README.md
  2. 9 0
      apps/petitions/petitions-app/go.sh

+ 6 - 0
apps/petitions/petitions-app/README.md

@@ -19,10 +19,16 @@ follow the [installation instructions](https://brew.sh/)
19 19
 
20 20
 ## Run
21 21
 
22
+On your local device 
22 23
 ```
23 24
 ./go.sh start
24 25
 ```
25 26
 
27
+On an external device 
28
+```
29
+./go.sh start-external-device
30
+```
31
+
26 32
 ## Test
27 33
 
28 34
 ### Unit Tests

+ 9 - 0
apps/petitions/petitions-app/go.sh

@@ -2,6 +2,12 @@ start() {
2 2
   npm install && npm start
3 3
 }
4 4
 
5
+start_external_device() {
6
+  npm install
7
+  ip=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
8
+  IP=$ip npm start
9
+}
10
+
5 11
 unit() {
6 12
   npm install && npm run test
7 13
 }
@@ -75,6 +81,9 @@ OPTION="$1"
75 81
     start)
76 82
       start
77 83
       ;;
84
+    start-external-device)
85
+      start_external_device
86
+      ;;
78 87
     start-services)
79 88
       start_petition_services
80 89
       ;;