File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,18 @@ import next from "next"
5
5
const port = process . env . PORT || 8080
6
6
const dev = process . env . NODE_ENV !== "production"
7
7
8
- if ( ! process . env . CODERV2_HOST ) {
9
- throw new Error ( "CODERV2_HOST must be set" )
10
- } else if ( ! / ^ h t t p ( s ) ? : \/ \/ / . test ( process . env . CODERV2_HOST ) ) {
11
- throw new Error ( "CODERV2_HOST must be http(s)" )
8
+ let coderV2Host = "http://127.0.0.1:3000"
9
+
10
+ if ( process . env . CODERV2_HOST ) {
11
+ if ( ! / ^ h t t p ( s ) ? : \/ \/ / . test ( process . env . CODERV2_HOST ) ) {
12
+ throw new Error ( "CODERV2_HOST must be http(s)" )
13
+ } else {
14
+ coderV2Host = process . env . CODERV2_HOST
15
+ }
12
16
}
13
17
18
+ console . log ( `Using CODERV2_HOST: ${ coderV2Host } ` )
19
+
14
20
const app = next ( { dev, dir : "./site" } )
15
21
const handle = app . getRequestHandler ( )
16
22
21
27
server . use (
22
28
"/api" ,
23
29
createProxyMiddleware ( "/api" , {
24
- target : process . env . CODERV2_HOST ,
30
+ target : coderV2Host ,
25
31
ws : true ,
26
32
secure : false ,
27
33
changeOrigin : true ,
You can’t perform that action at this time.
0 commit comments