|
35 | 35 | using Microsoft.EntityFrameworkCore; |
36 | 36 | using Microsoft.Extensions.Compliance.Classification; |
37 | 37 | using Microsoft.Extensions.Compliance.Redaction; |
38 | | -using Microsoft.Extensions.Configuration.AzureAppConfiguration; |
39 | 38 | using Microsoft.OpenApi.Models; |
40 | 39 | using Serilog; |
41 | 40 | using Serilog.Enrichers.Span; |
|
58 | 57 |
|
59 | 58 | static void RegisterServices(WebApplicationBuilder builder) |
60 | 59 | { |
61 | | - //load external configuration source if specified |
62 | | - var externalConfigurationSource = builder.Configuration.GetSection(AccountConstants.AppSettingsSectionNames.ExternalConfigurationSource).Get<string>(); |
63 | | - if (!string.IsNullOrEmpty(externalConfigurationSource)) |
64 | | - { |
65 | | - switch (externalConfigurationSource) |
66 | | - { |
67 | | - case ("AzureAppConfiguration"): |
68 | | - builder.Configuration.AddAzureAppConfiguration(options => |
69 | | - { |
70 | | - options.Connect(builder.Configuration.GetConnectionString("AzureAppConfiguration")) |
71 | | - // Load configuration values with no label |
72 | | - .Select("*", LabelFilter.Null) |
73 | | - // Load configuration values for service name |
74 | | - .Select("*", AccountConstants.ServiceName) |
75 | | - // Load configuration values for service name and environment |
76 | | - .Select("*", AccountConstants.ServiceName + ":" + builder.Environment.EnvironmentName); |
77 | | - |
78 | | - options.ConfigureKeyVault(kv => |
79 | | - { |
80 | | - kv.SetCredential(new DefaultAzureCredential()); |
81 | | - }); |
82 | | - |
83 | | - }); |
84 | | - break; |
85 | | - } |
86 | | - } |
| 60 | + // load external configuration source (if specified) |
| 61 | + builder.AddExternalConfiguration(AccountConstants.ServiceName); |
87 | 62 |
|
88 | 63 | //Initialize activity source |
89 | 64 | var assemblyVersion = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? string.Empty; |
|
0 commit comments