forked from BLC/AyposWeb
environemnt availability
This commit is contained in:
@@ -1,4 +1,12 @@
|
|||||||
# API Configuration
|
# API Configuration
|
||||||
VITE_API_URL=http://141.196.166.241:8003
|
VITE_API_URL=http://141.196.166.241:8003
|
||||||
|
|
||||||
|
# Vercel Deployment Configuration
|
||||||
|
NEXT_PUBLIC_ALLOWED_HOSTS=141.196.166.241
|
||||||
|
NEXT_PUBLIC_VERCEL_URL=${VERCEL_URL}
|
||||||
|
NODE_ENV=production
|
||||||
|
|
||||||
|
# CORS Configuration
|
||||||
|
CORS_ORIGIN=*
|
||||||
|
|
||||||
# Add other environment variables as needed
|
# Add other environment variables as needed
|
||||||
16
README.md
16
README.md
@@ -58,18 +58,6 @@ npm run preview
|
|||||||
- Resource Distribution Visualization
|
- Resource Distribution Visualization
|
||||||
- System Maintenance
|
- System Maintenance
|
||||||
|
|
||||||
## API Configuration
|
|
||||||
|
|
||||||
The application connects to an API server at `http://141.196.166.241:8003`. Make sure this endpoint is accessible from your network.
|
|
||||||
|
|
||||||
## Environment Variables
|
|
||||||
|
|
||||||
No additional environment variables are required to run the application in development mode.
|
|
||||||
|
|
||||||
## Browser Support
|
|
||||||
|
|
||||||
The application is optimized for modern browsers that support ES6+ features.
|
|
||||||
|
|
||||||
## Environment Configuration
|
## Environment Configuration
|
||||||
|
|
||||||
The application uses environment variables for configuration. To set up your environment:
|
The application uses environment variables for configuration. To set up your environment:
|
||||||
@@ -84,6 +72,6 @@ cp .env.example .env
|
|||||||
VITE_API_URL=http://your-api-server:port
|
VITE_API_URL=http://your-api-server:port
|
||||||
```
|
```
|
||||||
|
|
||||||
The following environment variables are available:
|
## Browser Support
|
||||||
|
|
||||||
- `VITE_API_URL`: The URL of the API server (default: http://141.196.166.241:8003)
|
The application is optimized for modern browsers that support ES6+ features.
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
// Environment configuration
|
// Environment configuration
|
||||||
const getApiUrl = (): string => {
|
const getApiUrl = (): string => {
|
||||||
// Use environment variable if available, fallback to development URL
|
// In production (Vercel), use the proxied path
|
||||||
|
if (import.meta.env.PROD) {
|
||||||
|
return '/api';
|
||||||
|
}
|
||||||
|
// In development, use the direct URL
|
||||||
return import.meta.env.VITE_API_URL || 'http://141.196.166.241:8003';
|
return import.meta.env.VITE_API_URL || 'http://141.196.166.241:8003';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
8
vercel.json
Normal file
8
vercel.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"rewrites": [
|
||||||
|
{
|
||||||
|
"source": "/api/:path*",
|
||||||
|
"destination": "http://141.196.166.241:8003/:path*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user