Have Task choose free ports for dev servers (#6145)

This commit is contained in:
James Brunton
2026-04-28 17:26:04 +01:00
committed by GitHub
parent 12a00fe9c5
commit 49f24fa7a9
9 changed files with 216 additions and 114 deletions

View File

@@ -39,6 +39,16 @@ export default defineConfig(({ mode }) => {
const tsconfigProject = TSCONFIG_MAP[effectiveMode];
// Backend proxy target: default localhost:8080. Override via BACKEND_URL env var
// so the top-level dev launcher can wire a dynamically-assigned backend port.
const backendUrl = process.env.BACKEND_URL || "http://localhost:8080";
const backendProxy = {
target: backendUrl,
changeOrigin: true,
secure: false,
xfwd: true,
};
return {
plugins: [
react(),
@@ -88,48 +98,13 @@ export default defineConfig(({ mode }) => {
effectiveMode === "desktop"
? undefined
: {
"/api": {
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
xfwd: true,
},
"/oauth2": {
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
xfwd: true,
},
"/saml2": {
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
xfwd: true,
},
"/login/oauth2": {
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
xfwd: true,
},
"/login/saml2": {
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
xfwd: true,
},
"/swagger-ui": {
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
xfwd: true,
},
"/v1/api-docs": {
target: "http://localhost:8080",
changeOrigin: true,
secure: false,
xfwd: true,
},
"/api": backendProxy,
"/oauth2": backendProxy,
"/saml2": backendProxy,
"/login/oauth2": backendProxy,
"/login/saml2": backendProxy,
"/swagger-ui": backendProxy,
"/v1/api-docs": backendProxy,
},
},
base: env.RUN_SUBPATH ? `/${env.RUN_SUBPATH}` : "./",