-
Notifications
You must be signed in to change notification settings - Fork 68
/
Startup.cs
28 lines (26 loc) · 1 KB
/
Startup.cs
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
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.AzureKeyVault;
using Microsoft.Extensions.Hosting;
using MyWarehouse.Infrastructure.AzureKeyVault.Settings;
namespace MyWarehouse.Infrastructure.AzureKeyVault
{
internal static class Startup
{
public static void ConfigureAppConfiguration(HostBuilderContext _, IConfigurationBuilder configBuilder)
{
var settings = configBuilder.Build().GetMyOptions<AzureKeyVaultSettings>();
if (settings.AddToConfiguration)
{
configBuilder.AddAzureKeyVault(
settings.ServiceUrl,
new KeyVaultClient(
new KeyVaultClient.AuthenticationCallback(
new AzureServiceTokenProvider().KeyVaultTokenCallback)),
new DefaultKeyVaultSecretManager()
);
}
}
}
}