eliminate manually update the appsettings.json file
This commit is contained in:
@@ -127,3 +127,4 @@ resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
|
||||
var connectionString = 'Server=${sqlServer.properties.fullyQualifiedDomainName}; Database=${sqlServer::database.name}; User=${appUser}'
|
||||
output connectionStringKey string = connectionStringKey
|
||||
output databaseName string = sqlServer::database.name
|
||||
output connectionString string = connectionString
|
||||
|
||||
@@ -15,9 +15,9 @@ param location string
|
||||
// }
|
||||
param resourceGroupName string = ''
|
||||
param webServiceName string = ''
|
||||
param catalogDatabaseName string = ''
|
||||
param catalogDatabaseName string = 'catalogDatabase'
|
||||
param catalogDatabaseServerName string = ''
|
||||
param identityDatabaseName string = ''
|
||||
param identityDatabaseName string = 'identityDatabase'
|
||||
param identityDatabaseServerName string = ''
|
||||
param appServicePlanName string = ''
|
||||
param keyVaultName string = ''
|
||||
@@ -55,6 +55,10 @@ module web './core/host/appservice.bicep' = {
|
||||
runtimeName: 'dotnetcore'
|
||||
runtimeVersion: '6.0'
|
||||
tags: union(tags, { 'azd-service-name': 'web' })
|
||||
appSettings: {
|
||||
CATALOG_CONNECTION_STRING_VALUE: '${catalogDb.outputs.connectionString}; Password=${appUserPassword}'
|
||||
IDENTITY_CONNECTION_STRING_VALUE: '${identityDb.outputs.connectionString}; Password=${appUserPassword}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,11 @@ public static class Dependencies
|
||||
// Requires LocalDB which can be installed with SQL Server Express 2016
|
||||
// https://www.microsoft.com/en-us/download/details.aspx?id=54284
|
||||
services.AddDbContext<CatalogContext>(c =>
|
||||
c.UseSqlServer(configuration.GetConnectionString("CatalogConnection")));
|
||||
c.UseSqlServer(configuration["CATALOG_CONNECTION_STRING_VALUE"]));
|
||||
|
||||
// Add Identity DbContext
|
||||
services.AddDbContext<AppIdentityDbContext>(options =>
|
||||
options.UseSqlServer(configuration.GetConnectionString("IdentityConnection")));
|
||||
options.UseSqlServer(configuration["IDENTITY_CONNECTION_STRING_VALUE"]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user