Skip to content

Commit 5ffa3ae

Browse files
committed
index on master: fe3db1b Merge branch 'master' into current2
1 parent fe3db1b commit 5ffa3ae

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

client/app/src/apis/instance.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
const { REACT_APP_HOST_ADDRESS, REACT_APP_SERVER_PORT } = process.env;
1+
const {
2+
REACT_APP_NODE_ENV, //
3+
REACT_APP_SERVER_HOST_ADDRESS, //
4+
REACT_APP_SERVER_PORT, //
5+
} = process.env;
26

37
export class HTTP {
48
private domain: string = "";
@@ -43,7 +47,11 @@ export class HTTP {
4347
}
4448

4549
const instance = new HTTP(
46-
`http://${REACT_APP_HOST_ADDRESS}:${REACT_APP_SERVER_PORT}`
50+
`http://${
51+
REACT_APP_NODE_ENV === "production"
52+
? REACT_APP_SERVER_HOST_ADDRESS
53+
: "localhost"
54+
}:${REACT_APP_SERVER_PORT}`
4755
);
4856

4957
export default instance;

config/.client.env

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
# If you want to deploy the production, put the "production".
2+
REACT_APP_NODE_ENV="development"
3+
14
# Client port number to open this react-app.
2-
PORT=80
5+
PORT=3000
36

47
# Enter the same value as the PORT environment variable written in .server.env.
58
REACT_APP_SERVER_PORT=8000
69

710
# Put the IP or host address of the computer you are using.
8-
REACT_APP_HOST_ADDRESS="52.78.64.144"
11+
# The REACT_APP_SERVER_HOST_ADDRESS below only works when REACT_APP_NODE_ENV is "production", otherwise it works as "localhost".
12+
REACT_APP_SERVER_HOST_ADDRESS="localhost"

0 commit comments

Comments
 (0)