View on GitHub

Arcus Security

Azure Security development in a breeze

Configuration secret provider

Configuration secret provider brings you all registered configuration providers of .NET Core by using IConfiguration to your application.

:warning: When using configuration secret provider, it will look for secrets in all configuration sources which is not secure. This provider should only be used for development.

Installation

The configuration secret provider is built-in as part of the package Arcus.Security.Core.

Configuration

public class Program
{
    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args)
    {    
        return Host.CreateDefaultBuilder(args)
                   .ConfigureAppConfiguration((context, config) => 
                   {
                       config.AddJsonFile("appsettings.json")
                             .AddJsonFile("appsettings.Development.json");
                   })
                   .ConfigureSecretStore((HostBuilderContext context, IConfiguration config, SecretStoreBuilder builder) =>
                   {
#if DEBUG
                       builder.AddConfiguration(config);
#endif
                   });
                   .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());
    }
}