Skip to content

Commit 02639a5

Browse files
env configuration
1 parent f4a2b27 commit 02639a5

File tree

8 files changed

+88
-114
lines changed

8 files changed

+88
-114
lines changed

infra/deploy_ai_foundry.bicep

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ output aiSearchId string = aiSearch.id
697697
output aiSearchTarget string = 'https://${aiSearch.name}.search.windows.net'
698698
output aiSearchService string = aiSearch.name
699699
output aiProjectName string = aiHubProject.name
700-
701700
output applicationInsightsId string = applicationInsights.id
702701
output logAnalyticsWorkspaceResourceName string = logAnalytics.name
703702
output storageAccountName string = storageNameCleaned
@@ -708,5 +707,5 @@ output azureOpenAIEndpoint string = aiServices.properties.endpoint
708707
output azureOpenAIDeploymentModel string = gptModelName
709708
output azureOpenAIResource string = aiServicesName
710709
output azureOpenAIPreviewApiVersion string = azureOpenAIApiVersion
711-
712710
output azureOpenAIKeyName string = azureOpenAIApiKeyEntry.name
711+
output azureAIProjectConnectionStringEntry string = '${split(aiHubProject.properties.discoveryUrl, '/')[2]};${subscription().subscriptionId};${resourceGroup().name};${aiHubProject.name}'

infra/deploy_app_service.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ resource configLogs 'Microsoft.Web/sites/config@2022-03-01' = {
6666
output identityPrincipalId string = appService.identity.principalId
6767
output appUrl string = 'https://${solutionName}.azurewebsites.net'
6868

69-
output REACT_APP_LAYOUT_CONFIG string = REACT_APP_LAYOUT_CONFIG
69+
7070

infra/deploy_backend_docker.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ resource aiDeveloperAccessProj 'Microsoft.Authorization/roleAssignments@2022-04-
137137
}
138138

139139
output appUrl string = appService.outputs.appUrl
140+
output REACT_APP_LAYOUT_CONFIG string = reactAppLayoutConfig

infra/deploy_frontend_docker.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ module appService 'deploy_app_service.bicep' = {
2424
}
2525

2626
output appUrl string = appService.outputs.appUrl
27+
output appInsightsInstrumentationKey string = reference(applicationInsightsId, '2015-05-01').InstrumentationKey

infra/main.bicep

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -225,46 +225,54 @@ module backend_docker 'deploy_backend_docker.bicep'= {
225225
scope: resourceGroup(resourceGroup().name)
226226
}
227227

228-
output WEB_APP_URL string = appserviceModule.outputs.webAppUrl
229-
output REACT_APP_LAYOUT_CONFIG string = appserviceModule.outputs.REACT_APP_LAYOUT_CONFIG
228+
module frontend_docker 'deploy_frontend_docker.bicep'= {
229+
name: 'deploy_frontend_docker'
230+
params: {
231+
imageTag: imageTag
232+
appServicePlanId: hostingplan.outputs.name
233+
applicationInsightsId: aifoundry.outputs.applicationInsightsId
234+
solutionName: solutionPrefix
235+
appSettings:{
236+
APP_API_BASE_URL:backend_docker.outputs.appUrl
237+
}
238+
}
239+
scope: resourceGroup(resourceGroup().name)
240+
}
241+
242+
output WEB_APP_URL string = frontend_docker.outputs.appUrl
243+
244+
// output WEB_APP_URL string = appserviceModule.outputs.webAppUrl
245+
output REACT_APP_LAYOUT_CONFIG string = backend_docker.outputs.REACT_APP_LAYOUT_CONFIG
230246

231247
output imageTag string = imageTag
232-
output applicationInsightsId string = aifoundry.outputs.applicationInsightsId
248+
// output applicationInsightsId string = aifoundry.outputs.applicationInsightsId
233249
// identity string =managedIdentityModule.outputs.managedIdentityOutput.id
234-
output solutionName string = solutionPrefix
250+
// output solutionName string = solutionPrefix
235251
// solutionLocation string = solutionLocation
252+
output APPINSIGHTS_INSTRUMENTATIONKEY string = frontend_docker.outputs.appInsightsInstrumentationKey
236253
output AZURE_OPENAI_ENDPOINT string = aifoundry.outputs.azureOpenAIEndpoint
237254
output AZURE_OPENAI_DEPLOYMENT_NAME string = gptModelName //'gpt-4o-mini'
238255
output AZURE_OPENAI_API_KEY string = aifoundry.outputs.azureOpenAIApiKey
239256
output AZURE_OPENAI_API_VERSION string = aifoundry.outputs.azureOpenAIApiVersion
240257
output AZURE_OPENAI_RESOURCE string =aifoundry.outputs.azureOpenAIResource
241258
output AZURE_OPENAI_PREVIEW_API_VERSION string = azureOpenAIApiVersion
242259

243-
output CHART_DASHBOARD_URL string =azureFunctionURL.outputs.functionURLsOutput.charts_function_url
244-
output CHART_DASHBOARD_FILTERS_URL string =azureFunctionURL.outputs.functionURLsOutput.filters_function_url
260+
// output CHART_DASHBOARD_URL string =
261+
// output CHART_DASHBOARD_FILTERS_URL string =
245262
output USE_GRAPHRAG string ='False'
246263
output USE_CHAT_HISTORY_ENABLED string ='True'
247-
output GRAPHRAG_URL string =azureFunctionURL.outputs.functionURLsOutput.graphrag_function_url
248-
output RAG_URL string =azureFunctionURL.outputs.functionURLsOutput.rag_function_url
264+
// output GRAPHRAG_URL string =azureFunctionURL.outputs.functionURLsOutput.graphrag_function_url
265+
// output RAG_URL string =azureFunctionURL.outputs.functionURLsOutput.rag_function_url
249266
output AZURE_COSMOSDB_ACCOUNT string = cosmosDBModule.outputs.cosmosAccountName
250267
output AZURE_COSMOSDB_ACCOUNT_KEY string = cosmosDBModule.outputs.cosmosAccountKey
251268
output AZURE_COSMOSDB_CONVERSATIONS_CONTAINER string = 'conversations'
252269
output AZURE_COSMOSDB_DATABASE string = 'db_conversaation_history'
253270
output AZURE_COSMOSDB_ENABLE_FEEDBACK string ='True'
254271
output DISPLAY_CHART_DEFAULT string = 'True'
255-
256-
module frontend_docker 'deploy_frontend_docker.bicep'= {
257-
name: 'deploy_frontend_docker'
258-
params: {
259-
imageTag: imageTag
260-
appServicePlanId: hostingplan.outputs.name
261-
applicationInsightsId: aifoundry.outputs.applicationInsightsId
262-
solutionName: solutionPrefix
263-
appSettings:{
264-
APP_API_BASE_URL:backend_docker.outputs.appUrl
265-
}
266-
}
267-
scope: resourceGroup(resourceGroup().name)
268-
}
269-
270-
output WEB_APP_URL string = frontend_docker.outputs.appUrl
272+
output AZURE_AI_PROJECT_CONN_STRING string = aifoundry.outputs.azureAIProjectConnectionStringEntry
273+
output USE_AI_PROJECT_CLIENT string = 'False'
274+
output SQLDB_DATABASE string = sqlDBModule.outputs.sqlDbName
275+
output SQLDB_SERVER string = sqlDBModule.outputs.sqlServerName
276+
output SQLDB_USERNAME string = sqlDBModule.outputs.sqlDbUser
277+
output SQLDB_USER_MID string = managedIdentityModule.outputs.managedIdentityBackendAppOutput.clientId
278+
output REACT_APP_API_BASE_URL string = backend_docker.outputs.appUrl
File renamed without changes.

src/App/start.cmd

Lines changed: 0 additions & 87 deletions
This file was deleted.

src/start.cmd

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,56 @@
11
@echo off
2+
echo 🔧 Starting the application setup...
3+
4+
REM Set root and config paths
5+
set ROOT_DIR=%cd%\..
6+
set AZURE_FOLDER=%ROOT_DIR%\.azure
7+
set CONFIG_FILE=%AZURE_FOLDER%\config.json
8+
9+
REM Validate config.json
10+
if not exist "%CONFIG_FILE%" (
11+
echo ❌ config.json not found at %CONFIG_FILE%
12+
exit /b 1
13+
)
14+
15+
REM Extract default environment name
16+
for /f "delims=" %%i in ('powershell -command "(Get-Content '%CONFIG_FILE%' | ConvertFrom-Json).defaultEnvironment"') do set DEFAULT_ENV=%%i
17+
18+
if not defined DEFAULT_ENV (
19+
echo ❌ Failed to extract defaultEnvironment from config.json
20+
exit /b 1
21+
)
22+
23+
REM Set path to source .env file
24+
set ENV_FILE=%AZURE_FOLDER%\%DEFAULT_ENV%\.env
25+
26+
if not exist "%ENV_FILE%" (
27+
echo ❌ .env file not found at %ENV_FILE%
28+
exit /b 1
29+
)
30+
31+
REM ✅ 1. Copy full .env to src/api
32+
set API_ENV_FILE=%ROOT_DIR%\src\api\.env
33+
copy /Y "%ENV_FILE%" "%API_ENV_FILE%"
34+
if errorlevel 1 (
35+
echo ❌ Failed to copy .env to src/api
36+
exit /b 1
37+
)
38+
echo ✅ Copied .env to src/api
39+
40+
REM ✅ 2. Extract REACT_APP_API_BASE_URL to src/App/.env
41+
set APP_ENV_FILE=%ROOT_DIR%\src\App\.env
42+
(for /f "tokens=1,* delims==" %%A in ('type "%ENV_FILE%" ^| findstr /B "REACT_APP_API_BASE_URL="') do (
43+
echo %%A=%%B
44+
)) > "%APP_ENV_FILE%"
45+
46+
if exist "%APP_ENV_FILE%" (
47+
echo ✅ Created src/App/.env with REACT_APP_API_BASE_URL
48+
) else (
49+
echo ❌ Failed to create src/App/.env
50+
exit /b 1
51+
)
52+
53+
254
echo Restoring backend Python packages...
355
cd api
456
call python -m pip install -r requirements.txt

0 commit comments

Comments
 (0)