Skip to content

Commit 664e7c8

Browse files
author
tienday
committed
improve frontend .env validation
1 parent 426d864 commit 664e7c8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: frontend/src/const/API.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const HOST =
2-
process.env.REACT_APP_SERVER_HOST ?? window.location.hostname ?? "localhost"
3-
const PORT = process.env.REACT_APP_SERVER_PORT ?? window.location.port ?? 8000
2+
process.env.REACT_APP_SERVER_HOST || window.location.hostname || "localhost"
3+
const PORT = process.env.REACT_APP_SERVER_PORT || window.location.port || 8000
44
const PROTO =
5-
process.env.REACT_APP_SERVER_PROTO ??
6-
window.location.protocol.replace(":", "") ??
5+
process.env.REACT_APP_SERVER_PROTO ||
6+
window.location.protocol.replace(":", "") ||
77
"http"
88

99
export const BASE_URL =

0 commit comments

Comments
 (0)