From 04d93d7d235d328ef40c9dae4e1f56dc8a5e893f Mon Sep 17 00:00:00 2001 From: Pawel Zelawski Date: Sat, 23 May 2026 11:11:53 +0200 Subject: feat: harden demo security and add full test suite --- vite.config.ts | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'vite.config.ts') diff --git a/vite.config.ts b/vite.config.ts index 69d80d1..6f8126d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,17 +1,22 @@ -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; import react from '@vitejs/plugin-react'; -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [react()], - server: { - proxy: { - // Proxy /api requests to the backend server (running on port 3000 now) - '/api': { - target: 'http://localhost:3000', // Adjust to match backend PORT from .env - changeOrigin: true, // Recommended for virtual hosted sites - secure: false, // Don't verify SSL certs if backend uses self-signed cert in dev +export default defineConfig(({ mode }) => { + const env = loadEnv(mode, process.cwd(), ''); + const backendPort = env.PORT ?? '3001'; + const backendTarget = + env.VITE_API_PROXY_TARGET ?? `http://localhost:${backendPort}`; + + return { + plugins: [react()], + server: { + proxy: { + '/api': { + target: backendTarget, + changeOrigin: true, + secure: false, + }, }, }, - }, -}); \ No newline at end of file + }; +}); -- cgit v1.2.3