Files
media-map/frontend/vite.config.ts
Danilo Reyes 98622c4119 Add host configuration for backend server and update documentation
- Introduced a new `host` option in `flake.nix` to specify the server's bind address, defaulting to `0.0.0.0`.
- Updated `run.sh` to use the `HOST` environment variable for server binding.
- Modified `config.py` to read the `HOST` from environment variables, defaulting to `0.0.0.0`.
- Enhanced `README.md` with instructions for setting up the `HOST` variable and clarified access details for development and production modes.
- Adjusted `vite.config.ts` to allow frontend access from other computers by default.
2025-12-28 21:20:21 -06:00

30 lines
735 B
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// Get backend URL from environment variables (for dev server proxy)
const backendHost = process.env.VITE_BACKEND_HOST || '127.0.0.1'
const backendPort = process.env.VITE_BACKEND_PORT || '8080'
const backendUrl = `http://${backendHost}:${backendPort}`
export default defineConfig({
plugins: [react()],
build: {
outDir: 'dist',
},
server: {
host: '0.0.0.0', // Allow access from other computers
port: parseInt(process.env.VITE_PORT || '5173'),
proxy: {
'/api': {
target: backendUrl,
changeOrigin: true,
},
'/admin': {
target: backendUrl,
changeOrigin: true,
},
},
},
})