-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathAppConfiguration.cs
More file actions
30 lines (24 loc) · 1.21 KB
/
AppConfiguration.cs
File metadata and controls
30 lines (24 loc) · 1.21 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
using Azure.Identity;
using Microsoft.Extensions.Azure;
using Microsoft.GS.DPSHost.AppConfiguration;
using Microsoft.GS.DPSHost.Helpers;
namespace Microsoft.GS.DPSHost.AppConfiguration
{
public class AppConfiguration
{
public static void Config(IHostApplicationBuilder builder)
{
//Read ServiceConfiguration files - appsettings.json / appsettings.Development.json
//builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
//builder.Configuration.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true);
//Read AppConfiguration with managed Identity
builder.Configuration.AddAzureAppConfiguration(options =>
{
options.Connect(new Uri(builder.Configuration["ConnectionStrings:AppConfig"]), AzureCredentialHelper.GetAzureCredential());
});
//Read ServiceConfiguration
builder.Services.Configure<AIServices>(builder.Configuration.GetSection("Application:AIServices"));
builder.Services.Configure<Services>(builder.Configuration.GetSection("Application:Services"));
}
}
}