Files
Bas Hulsken 22280d4c88 allow configuring LOCALAGI to use a custom base url (#469)
allow configuring LOCALAGI to use a custom base url other than the default :3000
2026-06-02 16:12:18 +02:00

38 lines
1.0 KiB
JavaScript

import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig(({ mode }) => {
// Load environment variables
const env = loadEnv(mode, process.cwd(), '')
// Define backend URL with port from environment variable or default to 8080
const backendUrl = `http://${env.LOCALAGI_BASE_URL || 'localhost:3000'}`
return {
plugins: [react()],
base: '/app', // Set the base path for production builds
server: {
proxy: {
// Proxy API requests to your Go backend
'/api': backendUrl,
// Proxy SSE endpoints
'/sse': backendUrl,
// Add other endpoints as needed
'/settings': backendUrl,
'/agents': backendUrl,
'/create': backendUrl,
'/delete': backendUrl,
'/pause': backendUrl,
'/start': backendUrl,
'/talk': backendUrl,
'/notify': backendUrl,
'/chat': backendUrl,
'/status': backendUrl,
'/action': backendUrl,
'/actions': backendUrl
}
}
}
});