Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/ConfigStoreDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public static IWebHost BuildWebHost(string[] args)
// 3. Set up the provider to listen for changes to the background color key-value in Azure App Configuration

var settings = config.AddJsonFile("appsettings.json").Build();

if (string.IsNullOrEmpty(settings["connection_string"]))
{
throw new InvalidOperationException(
"Connection string not found. " +
"Please set the 'connection_string' in appsettings.json.");
}

config.AddAzureAppConfiguration(options =>
{
options.Connect(settings["connection_string"])
Expand Down
5 changes: 4 additions & 1 deletion examples/ConsoleAppWithFailOver/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ private static void Configure()
IConfiguration configuration = builder.Build();

IConfigurationSection endpointsSection = configuration.GetSection("AppConfig:Endpoints");
IEnumerable<Uri> endpoints = endpointsSection.GetChildren().Select(endpoint => new Uri(endpoint.Value));
IEnumerable<Uri> endpoints = endpointsSection.GetChildren()
.Select(endpoint => endpoint.Value)
.Where(value => !string.IsNullOrEmpty(value))
.Select(value => new Uri(value));

if (endpoints == null || !endpoints.Any())
{
Expand Down
Loading