Skip to content
This repository was archived by the owner on Sep 19, 2021. It is now read-only.

Commit ff2ac9b

Browse files
authored
Merge pull request #30 from google/update-run-scripts
Exposing params in run scripts
2 parents f058608 + 17ff779 commit ff2ac9b

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

run_client.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
LOCAL_MACHINE="localhost@2007"
17+
HOST="$1"
18+
PORT="$2"
1819

19-
cd './bin'
20+
if [[ "$HOST" == "" || "$PORT" == "" ]] ; then
21+
echo 'usage: <HOST> <PORT>'
22+
exit 1
23+
fi
2024

21-
java codeu.chat.ClientMain "$LOCAL_MACHINE"
25+
cd './bin'
26+
java codeu.chat.ClientMain "$HOST@$PORT"

run_relay.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
TEAMS_FILE="$(pwd)/teams"
17+
PORT="$1"
18+
TEAM_FILE="$2"
19+
20+
if [[ "$PORT" == "" || "$TEAM_FILE" == "" ]] ; then
21+
echo 'usage: <PORT> <TEAM FILE>'
22+
exit 1
23+
fi
24+
25+
if [ ! -f "$TEAM_FILE" ] ; then
26+
echo "No file at $TEAM_FILE"
27+
exit 1
28+
fi
1829

1930
cd './bin'
20-
java codeu.chat.RelayMain '2008' "$TEAMS_FILE"
31+
java codeu.chat.RelayMain "$PORT" "$TEAM_FILE"

run_server.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,14 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
TEAM_ID="$1"
18+
TEAM_SECRET="$2"
19+
PORT="$3"
20+
21+
if [[ "TEAM_ID" == "" || "$TEAM_SECRET" == "" || "$PORT" == "" ]] ; then
22+
echo 'usage: <TEAM ID> <TEAM SECRET> <PORT>'
23+
exit 1
24+
fi
25+
1726
cd './bin'
18-
java codeu.chat.ServerMain "100.101" "ABABAB" "2007"
27+
java codeu.chat.ServerMain "$TEAM_ID" "$TEAM_SECRET" "$PORT"

0 commit comments

Comments
 (0)