prototype

This commit is contained in:
2026-05-05 18:41:51 +03:00
parent d4c42061ba
commit 5ddc23210b
23 changed files with 4920 additions and 1 deletions

64
vite.config.ts Normal file
View File

@@ -0,0 +1,64 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(({ mode }) => {
// Режим прямого подключения к одиночной ноде (dev-direct)
if (mode === 'development.direct') {
return {
plugins: [react()],
server: {
port: 5173,
proxy: {
'/v1': 'http://localhost:8080',
'/api': {
target: 'http://localhost:8445', // возвращаемся к порту 8445
changeOrigin: true,
// rewrite больше не нужен, т.к. на 8445 уже правильный путь /admin/users
},
'/ws': {
target: 'ws://localhost:8446',
ws: true,
},
},
},
};
}
// Режим разработки через Traefik (кластер, dev)
if (mode === 'development') {
return {
plugins: [react()],
server: {
port: 5173,
proxy: {
'/v1': {
target: 'https://localhost',
changeOrigin: true,
secure: false,
headers: {
Host: 'admin-api.eventhub.local',
},
},
'/api': {
target: 'https://localhost',
changeOrigin: true,
secure: false,
headers: {
Host: 'admin-api.eventhub.local',
},
rewrite: (path) => path.replace(/^\/api/, '/api/admin'),
},
'/ws': {
target: 'wss://localhost',
ws: true,
},
},
},
};
}
// Production (сборка) прокси не используется, запросы идут через Nginx/Docker
return {
plugins: [react()],
};
});