Skip to content

Commit

Permalink
Edit to remove compiler warnings from Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-foulkrod committed Mar 13, 2024
1 parent 4db6a0a commit 4fb34d8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
using Microsoft.eShopWeb.Web.Configuration;
using Microsoft.eShopWeb.Web.HealthChecks;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Azure.Identity;
using Microsoft.eShopWeb.Web.Pages;
using Microsoft.FeatureManagement;
using Microsoft.IdentityModel.Tokens;

var builder = WebApplication.CreateBuilder(args);
builder.Logging.AddConsole();

if (builder.Environment.IsDevelopment() || builder.Environment.EnvironmentName == "Docker"){
if (builder.Environment.IsDevelopment() || builder.Environment.EnvironmentName == "Docker")
{
// Configure SQL Server (local)
Microsoft.eShopWeb.Infrastructure.Dependencies.ConfigureServices(builder.Configuration, builder.Services);
}
else{
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);
Expand Down Expand Up @@ -110,7 +111,14 @@
{
builder.Configuration.AddAzureAppConfiguration(options =>
{
options.Connect(new Uri(builder.Configuration["AppConfigEndpoint"]), new DefaultAzureCredential())
var appConfigEndpoint = builder.Configuration["AppConfigEndpoint"];

if (String.IsNullOrEmpty(appConfigEndpoint))
{
throw new Exception("AppConfigEndpoint is not set in the configuration. Please set AppConfigEndpoint in the configuration.");
}

options.Connect(new Uri(appConfigEndpoint), new DefaultAzureCredential())
.ConfigureRefresh(refresh =>
{
// Default cache expiration is 30 seconds
Expand Down

0 comments on commit 4fb34d8

Please sign in to comment.