8753e84a03
Resolve VERSION from EventHubSpec; VITE_APP_BUILD from run_number; show Admin UI / API as version.build (sha). Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import path from 'node:path';
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
|
|
const apiBaseUrl = process.env.VITE_API_BASE_URL ?? 'https://admin-api.dev.eventhub.local';
|
|
const wsUrl = process.env.VITE_WS_URL ?? 'wss://admin-ws.dev.eventhub.local';
|
|
|
|
const appVersion = process.env.VITE_APP_VERSION ?? '0.0';
|
|
const appBuild = process.env.VITE_APP_BUILD ?? '0';
|
|
const gitSha = process.env.VITE_GIT_SHA ?? 'dev';
|
|
const builtAt = process.env.VITE_BUILT_AT ?? '';
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
define: {
|
|
'import.meta.env.VITE_APP_VERSION': JSON.stringify(appVersion),
|
|
'import.meta.env.VITE_APP_BUILD': JSON.stringify(appBuild),
|
|
'import.meta.env.VITE_GIT_SHA': JSON.stringify(gitSha),
|
|
'import.meta.env.VITE_BUILT_AT': JSON.stringify(builtAt),
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
'/v1': {
|
|
target: apiBaseUrl,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
'/admin/ws': {
|
|
target: wsUrl,
|
|
ws: true,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
},
|
|
},
|
|
});
|