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.
This commit is contained in:
parent
3226a68613
commit
2811a84deb
1 changed files with 41 additions and 0 deletions
41
vite.operator-dashboard.config.mjs
Normal file
41
vite.operator-dashboard.config.mjs
Normal file
|
|
@ -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 }),
|
||||
},
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue