diff --git a/infra/main.bicep b/infra/main.bicep index f92f2bf6..9bdfa1a6 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -78,6 +78,9 @@ param useApplicationInsights bool = false param allowedOrigin string +// Allow to override the default backend +param backendUri string = '' + // Only needed for CD due to internal policies restrictions param aliasTag string = '' // Differentiates between automated and manual deployments @@ -536,3 +539,4 @@ output SEARCH_API_URI string = searchApi.outputs.uri output INDEXER_API_URI string = indexerApi.outputs.uri output ALLOWED_ORIGINS string = join(allowedOrigins, ',') +output BACKEND_URI string = !empty(backendUri) ? backendUri : searchApi.outputs.uri diff --git a/infra/main.parameters.json b/infra/main.parameters.json index c4ce31fb..94bf99d2 100644 --- a/infra/main.parameters.json +++ b/infra/main.parameters.json @@ -77,6 +77,9 @@ "allowedOrigin": { "value": "${ALLOWED_ORIGIN=''}" }, + "backendUri": { + "value": "${BACKEND_URI}" + }, "aliasTag": { "value": "${AZURE_ALIAS}" }, diff --git a/packages/webapp/vite.config.ts b/packages/webapp/vite.config.ts index 05afdbeb..5abddebb 100644 --- a/packages/webapp/vite.config.ts +++ b/packages/webapp/vite.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; // Expose environment variables to the client -process.env.VITE_SEARCH_API_URI = process.env.SEARCH_API_URI ?? ''; +process.env.VITE_SEARCH_API_URI = process.env.BACKEND_URI ?? ''; console.log(`Using search API base URL: "${process.env.VITE_SEARCH_API_URI}"`); // https://vitejs.dev/config/