File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1+ # If you want to deploy the production, put the "production".
2+ NODE_ENV = " development"
3+
14# NodeJS
25PORT = 8000
3- HOST_ADDRESS = " 52.78.64.144" # Put the IP or host address of the computer you are using.
46
5- # for accessing from Nodejs to MySQL
7+ # Put the IP or host address of the computer you are using.
8+ # The HOST_ADDRESS below only works when NODE_ENV is "production", otherwise it works as "localhost".
9+ HOST_ADDRESS = " localhost"
10+
11+ # For accessing from Nodejs to MySQL
612DB_HOST = " db"
713DB_USER = " root"
814DB_PSWORD = " password"
Original file line number Diff line number Diff line change @@ -9,13 +9,15 @@ dotenv.config({ path: '../../config/.server.env' });
99
1010const app = express ( ) ;
1111const PORT = process . env . PORT || 8000 ;
12- const HOST_ADDRESS = process . env . HOST_ADDRESS || 'localhost'
12+ const HOST_ADDRESS =
13+ process . env . NODE_ENV === 'production'
14+ ? process . env . HOST_ADDRESS || 'localhost'
15+ : 'localhost' ;
1316
1417const swaggerSpec = YAML . load ( path . join ( __dirname , './swagger.yaml' ) ) ;
15- const portInjectedSwaggerSpec = JSON . stringify ( swaggerSpec ) . replace (
16- '{PORT}' ,
17- PORT . toString ( )
18- ) . replace ( '{HOST_ADDRESS}' , HOST_ADDRESS ) ;
18+ const portInjectedSwaggerSpec = JSON . stringify ( swaggerSpec )
19+ . replace ( '{PORT}' , PORT . toString ( ) )
20+ . replace ( '{HOST_ADDRESS}' , HOST_ADDRESS ) ;
1921
2022import visitor from './src/apis/visitor' ;
2123
You can’t perform that action at this time.
0 commit comments