Skip to content

Commit

Permalink
Revert "Add fail-over support to config provider. (#319)" (#326)
Browse files Browse the repository at this point in the history
This reverts commit c8f7724.
  • Loading branch information
avanigupta authored Jun 29, 2022
1 parent f210ee5 commit 33b3dbd
Show file tree
Hide file tree
Showing 34 changed files with 745 additions and 1,442 deletions.
10 changes: 2 additions & 8 deletions Microsoft.Extensions.Configuration.AzureAppConfiguration.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32503.460
# Visual Studio Version 16
VisualStudioVersion = 16.0.29920.165
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Configuration.AzureAppConfiguration", "src\Microsoft.Extensions.Configuration.AzureAppConfiguration\Microsoft.Extensions.Configuration.AzureAppConfiguration.csproj", "{7B793D44-EC46-4C12-B71F-3A5005290C75}"
EndProject
Expand All @@ -19,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.AppConfigur
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.AzureAppConfiguration.Functions.Worker", "tests\Tests.AzureAppConfiguration.Functions.Worker\Tests.AzureAppConfiguration.Functions.Worker.csproj", "{A9287214-6689-479F-A9F8-D0C02DE433F0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleAppWithFailOver", "examples\ConsoleAppWithFailOver\ConsoleAppWithFailOver.csproj", "{A6C611F1-D687-4262-8904-828C239CF2E5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -59,10 +57,6 @@ Global
{A9287214-6689-479F-A9F8-D0C02DE433F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9287214-6689-479F-A9F8-D0C02DE433F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9287214-6689-479F-A9F8-D0C02DE433F0}.Release|Any CPU.Build.0 = Release|Any CPU
{A6C611F1-D687-4262-8904-828C239CF2E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6C611F1-D687-4262-8904-828C239CF2E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6C611F1-D687-4262-8904-828C239CF2E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6C611F1-D687-4262-8904-828C239CF2E5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
24 changes: 0 additions & 24 deletions examples/ConsoleAppWithFailOver/ConsoleAppWithFailOver.csproj

This file was deleted.

52 changes: 0 additions & 52 deletions examples/ConsoleAppWithFailOver/Program.cs

This file was deleted.

6 changes: 0 additions & 6 deletions examples/ConsoleAppWithFailOver/appsettings.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,13 @@ public static IServiceCollection AddAzureAppConfiguration(this IServiceCollectio
services.AddSingleton<IConfigurationRefresherProvider, AzureAppConfigurationRefresherProvider>();
return services;
}

internal static IConfigurationBuilder AddAzureAppConfiguration(
this IConfigurationBuilder configurationBuilder,
Action<AzureAppConfigurationOptions> action,
IConfigurationClientFactory configurationClientFactory)
{
return configurationBuilder.Add(new AzureAppConfigurationSource(action, optional: false, configurationClientFactory));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public class AzureAppConfigurationOptions
internal string ConnectionString { get; private set; }

/// <summary>
/// The list of endpoints of an Azure App Configuration store.
/// The endpoint of the Azure App Configuration.
/// If this property is set, the <see cref="Credential"/> property also needs to be set.
/// </summary>
internal IEnumerable<Uri> Endpoints { get; private set; }
internal Uri Endpoint { get; private set; }

/// <summary>
/// The credential used to connect to the Azure App Configuration.
/// If this property is set, the <see cref="Endpoints"/> property also needs to be set.
/// The connection string to use to connect to Azure App Configuration.
/// If this property is set, the <see cref="Endpoint"/> property also needs to be set.
/// </summary>
internal TokenCredential Credential { get; private set; }

Expand Down Expand Up @@ -83,10 +83,9 @@ internal IEnumerable<IKeyValueAdapter> Adapters
internal IEnumerable<string> KeyPrefixes => _keyPrefixes;

/// <summary>
/// An optional configuration client manager that can be used to provide clients to communicate with Azure App Configuration.
/// An optional client that can be used to communicate with Azure App Configuration. If provided, the connection string property will be ignored.
/// </summary>
/// <remarks>This property is used only for unit testing.</remarks>
internal IConfigurationClientManager ClientManager { get; set; }
internal ConfigurationClient Client { get; set; }

/// <summary>
/// Options used to configure the client used to communicate with Azure App Configuration.
Expand Down Expand Up @@ -257,7 +256,7 @@ public AzureAppConfigurationOptions Connect(string connectionString)
throw new ArgumentNullException(nameof(connectionString));
}

Endpoints = null;
Endpoint = null;
Credential = null;
ConnectionString = connectionString;
return this;
Expand All @@ -280,30 +279,9 @@ public AzureAppConfigurationOptions Connect(Uri endpoint, TokenCredential creden
throw new ArgumentNullException(nameof(credential));
}

return Connect(new List<Uri>() { endpoint }, credential);
}

/// <summary>
/// Connect the provider to an Azure App Configuration store and its replicas using a list of endpoints and a token credential.
/// </summary>
/// <param name="endpoints">The list of endpoints of an Azure App Configuration store and its replicas to connect to.</param>
/// <param name="credential">Token credential to use to connect.</param>
public AzureAppConfigurationOptions Connect(IEnumerable<Uri> endpoints, TokenCredential credential)
{
if (endpoints == null || !endpoints.Any())
{
throw new ArgumentNullException(nameof(endpoints));
}

if (endpoints.Distinct(new EndpointComparer()).Count() != endpoints.Count())
{
throw new ArgumentException($"All values in '{nameof(endpoints)}' must be unique.");
}

Credential = credential ?? throw new ArgumentNullException(nameof(credential));

Endpoints = endpoints;
ConnectionString = null;
Endpoint = endpoint;
Credential = credential;
return this;
}

Expand Down
Loading

0 comments on commit 33b3dbd

Please sign in to comment.