From 2811a84deb903a02a38a4947f19a3d6ee3f20b0a Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 8 Apr 2026 19:40:40 +0200 Subject: [PATCH] Ship dashboard build config Proof: Include the Vite config required for the dashboard-builder image stage to build operator-dashboard static assets during deployment. Assumptions: The current Vite config in the worktree is the intended build config for the deployed operator-dashboard frontend. Still fake: External alert receiver remains unconfigured; this commit only resolves the image-build blocker for the dashboard deploy. --- vite.operator-dashboard.config.mjs | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 vite.operator-dashboard.config.mjs diff --git a/vite.operator-dashboard.config.mjs b/vite.operator-dashboard.config.mjs new file mode 100644 index 0000000..1561f3e --- /dev/null +++ b/vite.operator-dashboard.config.mjs @@ -0,0 +1,41 @@ +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; + +function buildProxyConfig({ target, authHeader, websocket = false }) { + return { + target, + changeOrigin: true, + ws: websocket, + configure(proxy) { + if (!authHeader) return; + proxy.on('proxyReq', (proxyReq) => { + proxyReq.setHeader('Authorization', authHeader); + }); + proxy.on('proxyReqWs', (proxyReq) => { + proxyReq.setHeader('Authorization', authHeader); + }); + }, + }; +} + +const target = process.env.OPERATOR_DASHBOARD_DEV_UPSTREAM_URL || 'http://127.0.0.1:18090'; +const authHeader = process.env.OPERATOR_DASHBOARD_DEV_BASIC_AUTH_HEADER || ''; + +export default defineConfig({ + plugins: [react()], + root: 'src/operator-dashboard/static', + build: { + outDir: '../dist', + emptyOutDir: true, + }, + server: { + host: process.env.OPERATOR_DASHBOARD_DEV_HOST || '127.0.0.1', + port: Number(process.env.OPERATOR_DASHBOARD_DEV_PORT || 5173), + strictPort: true, + proxy: { + '/api': buildProxyConfig({ target, authHeader }), + '/healthz': buildProxyConfig({ target, authHeader }), + '/ws': buildProxyConfig({ target, authHeader, websocket: true }), + }, + }, +});