update variable
This commit is contained in:
@@ -23,10 +23,14 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
|
|
||||||
builder.Logging.AddConsole();
|
builder.Logging.AddConsole();
|
||||||
|
|
||||||
var azdTemplate= builder.Configuration["AZD_TEMPLATE"];
|
var env = builder.Configuration["Environment"];
|
||||||
|
|
||||||
if (azdTemplate == "enable"){
|
if (env == "Local"){
|
||||||
// Configure SQL Server (Azd template)
|
// Configure SQL Server (local)
|
||||||
|
Microsoft.eShopWeb.Infrastructure.Dependencies.ConfigureServices(builder.Configuration, builder.Services);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// Configure SQL Server (prod)
|
||||||
var credential = new ChainedTokenCredential(new AzureDeveloperCliCredential(), new DefaultAzureCredential());
|
var credential = new ChainedTokenCredential(new AzureDeveloperCliCredential(), new DefaultAzureCredential());
|
||||||
builder.Configuration.AddAzureKeyVault(new Uri(builder.Configuration["AZURE_KEY_VAULT_ENDPOINT"]), credential);
|
builder.Configuration.AddAzureKeyVault(new Uri(builder.Configuration["AZURE_KEY_VAULT_ENDPOINT"]), credential);
|
||||||
builder.Services.AddDbContext<CatalogContext>(c =>
|
builder.Services.AddDbContext<CatalogContext>(c =>
|
||||||
@@ -40,10 +44,6 @@ if (azdTemplate == "enable"){
|
|||||||
options.UseSqlServer(connectionString, sqlOptions => sqlOptions.EnableRetryOnFailure());
|
options.UseSqlServer(connectionString, sqlOptions => sqlOptions.EnableRetryOnFailure());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
// Configure SQL Server (Locally)
|
|
||||||
Microsoft.eShopWeb.Infrastructure.Dependencies.ConfigureServices(builder.Configuration, builder.Services);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Services.AddCookieSettings();
|
builder.Services.AddCookieSettings();
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"IdentityConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"
|
"IdentityConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"
|
||||||
},
|
},
|
||||||
"CatalogBaseUrl": "",
|
"CatalogBaseUrl": "",
|
||||||
|
"Environment": "Local",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"IncludeScopes": false,
|
"IncludeScopes": false,
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
|
|||||||
Reference in New Issue
Block a user