File tree Expand file tree Collapse file tree 4 files changed +25
-8
lines changed Expand file tree Collapse file tree 4 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 1+ # Backend API URL - the target for all proxy endpoints
2+ BACKEND_API_URL = http://localhost:3001
3+
4+ # Server port for the Vite development server
5+ SERVER_PORT = 3000
Original file line number Diff line number Diff line change 99 "preview" : " vite preview"
1010 },
1111 "dependencies" : {
12+ "@microsoft/applicationinsights-react-js" : " ^18.3.6" ,
13+ "@microsoft/applicationinsights-web" : " ^3.3.6" ,
1214 "lucide-react" : " ^0.344.0" ,
1315 "react" : " ^18.3.1" ,
1416 "react-dom" : " ^18.3.1" ,
15- "react-router-dom" : " ^6.22.3" ,
16- "@microsoft/applicationinsights-react-js" : " ^18.3.6" ,
17- "@microsoft/applicationinsights-web" : " ^3.3.6"
17+ "react-router-dom" : " ^6.22.3"
1818 },
1919 "devDependencies" : {
2020 "@types/react" : " ^18.3.5" ,
2121 "@types/react-dom" : " ^18.3.0" ,
2222 "@vitejs/plugin-react" : " ^4.3.1" ,
2323 "autoprefixer" : " ^10.4.18" ,
24+ "dotenv" : " ^16.4.7" ,
2425 "eslint-plugin-react-hooks" : " ^5.1.0-rc.0" ,
2526 "eslint-plugin-react-refresh" : " ^0.4.11" ,
2627 "postcss" : " ^8.4.35" ,
2728 "tailwindcss" : " ^3.4.1" ,
2829 "vite" : " ^5.4.2"
2930 }
30- }
31+ }
Original file line number Diff line number Diff line change 11import { defineConfig } from 'vite' ;
22import react from '@vitejs/plugin-react' ;
33import { resolve } from 'path' ;
4+ import dotenv from 'dotenv' ;
5+
6+ // Load environment variables from .env file
7+ dotenv . config ( ) ;
8+
9+ // Define backend API target URL that can be easily changed
10+ const BACKEND_API_URL = process . env . BACKEND_API_URL || 'http://localhost:3001' ;
11+ // Define server port that can be configured via environment variable
12+ const SERVER_PORT = parseInt ( process . env . SERVER_PORT || '3000' , 10 ) ;
413
514export default defineConfig ( {
615 plugins : [ react ( ) ] ,
@@ -9,14 +18,14 @@ export default defineConfig({
918 } ,
1019 server : {
1120 host : '0.0.0.0' , // Allow access from any IP address
12- port : 3000 , // Port for the Vite server
21+ port : SERVER_PORT , // Port for the Vite server from environment variables
1322 proxy : {
1423 '/v1/mcp' : {
15- target : 'http://localhost:3001' ,
24+ target : BACKEND_API_URL ,
1625 changeOrigin : true
1726 } ,
1827 '/v1/hub' : {
19- target : 'http://localhost:3001' ,
28+ target : BACKEND_API_URL ,
2029 changeOrigin : true
2130 }
2231 }
You can’t perform that action at this time.
0 commit comments