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.
This commit is contained in:
Danilo Reyes
2025-12-28 21:20:21 -06:00
parent 96fcc2b9e8
commit 98622c4119
5 changed files with 63 additions and 16 deletions

View File

@@ -1,19 +1,26 @@
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: 'http://127.0.0.1:8080',
target: backendUrl,
changeOrigin: true,
},
'/admin': {
target: 'http://127.0.0.1:8080',
target: backendUrl,
changeOrigin: true,
},
},