|
20 | 20 | const string PROJECT_ID = "ACM"; |
21 | 21 |
|
22 | 22 | // Add services to the container. |
23 | | -builder.Configuration.AddAzureAppConfiguration(options => |
24 | | -{ |
25 | | - var azureAppConfigConnectionString = builder.Configuration.GetConnectionString("AzureAppConfig"); |
26 | | - options.Connect(azureAppConfigConnectionString) |
27 | | - .Select(keyFilter: $"{PROJECT_ID}_*") |
28 | | - .Select(keyFilter: $"{PROJECT_ID}_*", labelFilter: builder.Environment.EnvironmentName) |
29 | | - .ConfigureRefresh(x => x.SetCacheExpiration(TimeSpan.FromDays(1))); |
30 | | -}); |
| 23 | +builder.Configuration |
| 24 | + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) |
| 25 | + .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true) |
| 26 | + .AddUserSecrets<Program>(optional: true, reloadOnChange: true) |
| 27 | + .AddAzureAppConfiguration(options => |
| 28 | + { |
| 29 | + var azureAppConfigConnectionString = builder.Configuration.GetConnectionString("AzureAppConfig"); |
| 30 | + options.Connect(azureAppConfigConnectionString) |
| 31 | + .Select(keyFilter: $"{PROJECT_ID}:*", LabelFilter.Null) |
| 32 | + .Select(keyFilter: $"{PROJECT_ID}:*", labelFilter: builder.Environment.EnvironmentName) |
| 33 | + .ConfigureRefresh(x => x |
| 34 | + .Register($"{PROJECT_ID}:AzureAppConfig:Sentinel", refreshAll: true) |
| 35 | + .SetCacheExpiration(TimeSpan.FromHours(1))) |
| 36 | + .TrimKeyPrefix($"{PROJECT_ID}:"); |
| 37 | + }); |
31 | 38 |
|
32 | 39 | ConfigureServices(builder.Services, builder.Configuration); |
33 | 40 | ConfigureDataAccess(builder.Services, builder.Configuration); |
@@ -102,12 +109,6 @@ static void ConfigureServices(IServiceCollection services, IConfiguration config |
102 | 109 | opts.FallbackPolicy = policy; |
103 | 110 | }); |
104 | 111 |
|
105 | | - /*services.AddAuthentication(opts => |
106 | | - { |
107 | | - opts.DefaultAuthenticateScheme = ""; |
108 | | - opts.DefaultChallengeScheme = ""; |
109 | | - });*/ |
110 | | - |
111 | 112 | services.Configure<RedditSettings>(configuration.GetSection("RedditSettings")); |
112 | 113 |
|
113 | 114 | services.AddMemoryCache(); |
|
0 commit comments