Skip to content

Commit 977ee38

Browse files
fix(config-ui): make dev api proxy target configurable via VITE_DEVLAKE_URL
Allow overriding the Vite dev server /api proxy target using VITE_DEVLAKE_URL, defaulting to http://localhost:8080. This avoids modifying the tracked vite.config.ts during local or dev container development.
1 parent 05dad99 commit 977ee38

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎config-ui/env.example‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ DEVLAKE_DASHBOARD_URL_BITBUCKET=/grafana/d/4LzQHZa4k/bitbucket?orgId=1&var-repo_
3333
DEVLAKE_DASHBOARD_URL_AZUREDEVOPS=/grafana/d/ba7e3a95-80ed-4067-a54b-2a82758eb3dd/azure-devops?orgId=1&var-repo_id=All&var-interval=WEEKDAY
3434
DEVLAKE_DASHBOARD_URL_ASANA=/grafana/d/asana-dashboard?orgId=1
3535

36+
# Vite dev server DevLake backend target (for `yarn start`)
37+
# VITE_DEVLAKE_URL=http://localhost:8080
38+
3639
# Vite dev server Grafana target (for `yarn start`)
3740
# VITE_GRAFANA_URL=http://localhost:3001
3841
# VITE_GRAFANA_PROTOCOL=http

‎config-ui/vite.config.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import { defineConfig } from 'vite';
2121
import react from '@vitejs/plugin-react';
2222
import svgr from 'vite-plugin-svgr';
2323

24+
// Allow DevLake API access from the dev server when using Dev Container or custom host/port
25+
const devlakeOrigin = process.env.VITE_DEVLAKE_URL || 'http://localhost:8080';
26+
2427
// Allow Grafana access from the dev server when using Dev Container
2528
const grafanaProtocol = process.env.VITE_GRAFANA_PROTOCOL || 'http';
2629
const grafanaHost = process.env.VITE_GRAFANA_HOST || 'localhost';
@@ -38,7 +41,7 @@ export default defineConfig({
3841
port: 4000,
3942
proxy: {
4043
'/api': {
41-
target: 'http://localhost:8080/',
44+
target: devlakeOrigin,
4245
changeOrigin: true,
4346
rewrite: (path) => path.replace(/^\/api\//, ''),
4447
},

0 commit comments

Comments
 (0)