-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathProgram.cs
More file actions
47 lines (45 loc) · 2.16 KB
/
Program.cs
File metadata and controls
47 lines (45 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.FeatureManagement;
using System;
namespace FunctionAppIsolatedMode
{
public class Program
{
public static void Main()
{
var host = new HostBuilder()
.ConfigureAppConfiguration(builder =>
{
builder.AddAzureAppConfiguration(options =>
{
options.Connect(Environment.GetEnvironmentVariable("ConnectionString"))
// Load all keys that start with `TestApp:` and have no label
.Select("TestApp:*")
// Configure to reload configuration if the registered key 'TestApp:Settings:Sentinel' is modified.
// Use the default cache expiration of 30 seconds. It can be overriden via AzureAppConfigurationRefreshOptions.SetCacheExpiration.
.ConfigureRefresh(refreshOptions =>
{
refreshOptions.Register("TestApp:Settings:Sentinel", refreshAll: true);
})
// Load all feature flags with no label. To load specific feature flags and labels, set via FeatureFlagOptions.Select.
// Use the default cache expiration of 30 seconds. It can be overriden via FeatureFlagOptions.CacheExpirationInterval.
.UseFeatureFlags();
});
})
.ConfigureServices(services =>
{
// Make Azure App Configuration services and feature manager available through dependency injection
services.AddAzureAppConfiguration()
.AddFeatureManagement();
})
.ConfigureFunctionsWorkerDefaults(app =>
{
// Use Azure App Configuration middleware for data refresh
app.UseAzureAppConfiguration();
})
.Build();
host.Run();
}
}
}