Skip to content

Commit

Permalink
update variable
Browse files Browse the repository at this point in the history
  • Loading branch information
zedy committed Feb 17, 2023
1 parent 7e99523 commit 3e0ca98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@

builder.Logging.AddConsole();

var azdTemplate= builder.Configuration["AZD_TEMPLATE"];
var env = builder.Configuration["Environment"];

if (azdTemplate == "enable"){
// Configure SQL Server (Azd template)
if (env == "Local"){
// 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());
builder.Configuration.AddAzureKeyVault(new Uri(builder.Configuration["AZURE_KEY_VAULT_ENDPOINT"]), credential);
builder.Services.AddDbContext<CatalogContext>(c =>
Expand All @@ -40,10 +44,6 @@
options.UseSqlServer(connectionString, sqlOptions => sqlOptions.EnableRetryOnFailure());
});
}
else{
// Configure SQL Server (Locally)
Microsoft.eShopWeb.Infrastructure.Dependencies.ConfigureServices(builder.Configuration, builder.Services);
}

builder.Services.AddCookieSettings();

Expand Down
1 change: 1 addition & 0 deletions src/Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"IdentityConnection": "Server=(localdb)\\mssqllocaldb;Integrated Security=true;Initial Catalog=Microsoft.eShopOnWeb.Identity;"
},
"CatalogBaseUrl": "",
"Environment": "Local",
"Logging": {
"IncludeScopes": false,
"LogLevel": {
Expand Down

0 comments on commit 3e0ca98

Please sign in to comment.