Skip to content

Commit

Permalink
Update env variables to deploy online attempt 5000
Browse files Browse the repository at this point in the history
  • Loading branch information
uo288543 committed Apr 8, 2024
1 parent 5c5363a commit 0625229
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ services:
- mynetwork
environment:
REACT_APP_API_ENDPOINT: http://gatewayservice:8000
MULTIPLAYER_ENDPOINT: http://multiplayer:5010
REACT_APP_MULTIPLAYER_ENDPOINT: http://multiplayer:5010

multiplayer:
container_name: multiplayer
Expand Down
4 changes: 2 additions & 2 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ WORKDIR /app
RUN npm install

ARG API_URI="http://localhost:8000"
ARG MULTIPLAYER_ENDPOINT
ENV MULTIPLAYER_ENDPOINT=$MULTIPLAYER_ENDPOINT
ARG REACT_APP_MULTIPLAYER_ENDPOINT
ENV REACT_APP_MULTIPLAYER_ENDPOINT=$REACT_APP_MULTIPLAYER_ENDPOINT
ENV REACT_APP_API_ENDPOINT=$API_URI

#Create an optimized version of the webapp
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/pages/MultiplayerGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useLocation } from 'react-router-dom';
import io from 'socket.io-client';

const apiEndpoint = process.env.REACT_APP_API_ENDPOINT || 'http://localhost:8000';
const socketEndpoint = process.env.MULTIPLAYER_ENDPOINT || 'ws://localhost:5010';
const socketEndpoint = process.env.REACT_APP_MULTIPLAYER_ENDPOINT || 'ws://localhost:5010';

const Game = () => {

Expand Down
4 changes: 2 additions & 2 deletions webapp/src/pages/MultiplayerRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useContext } from 'react';
import { SessionContext } from '../SessionContext';
import { useNavigate } from 'react-router-dom';

const socketEndpoint = process.env.MULTIPLAYER_ENDPOINT || 'http://localhost:5010';
const socketEndpoint = process.env.REACT_APP_MULTIPLAYER_ENDPOINT || 'http://localhost:5010';
//const socketEndpoint = process.env.MULTIPLAYER_ENDPOINT || 'ws://20.19.89.97/:5010'; do not work

const MultiplayerRoom = () => {
Expand All @@ -24,7 +24,7 @@ const MultiplayerRoom = () => {

useEffect(() => {
console.log("SOCKET ENDPOINT URL: ", socketEndpoint)
console.log("process.env.MULTIPLAYER_ENDPOINT: ", process.env.MULTIPLAYER_ENDPOINT);
console.log("process.env.REACT_APP_MULTIPLAYER_ENDPOINT: ", process.env.MULTIPLAYER_ENDPOINT);
const newSocket = io(socketEndpoint);
setSocket(newSocket);

Expand Down

0 comments on commit 0625229

Please sign in to comment.