When using the AdminUI nuget package there is a new method of configuring AdminUI, this method allows you to implement your own custom implementation of the IAdminUISettings
interface. This is in addition to the existing methods of configuring AdminUI.
Logging settings
Logging settings are still obtained from the environment so must be set via an appsettings.json
file, or as envorments variables.
Using the New Settings Model
From AdminUI 6.8 onwards there is a new way of configuring the settings for AdminUI that doesn't rely on reading configuration data from key-value pairs using configuration sources such as appsettings.json or environment variables.
The new way to define settings is via the new IAdminUISettings
interface:
public class MyAdminUISettings : IAdminUISettings {
public string DbProvider { get; set; }
...
}
This is how you can set it in Program.cs:
// Program.cs
var builder = WebApplication.CreateBuilder(args);
// Populate settings from anywhere you like
var settings = new MyAdminUISettings();
builder.Services.AddAdminUI(settings);
var app = builder.Build();
app.UseAdminUI();
app.Run();
If you prefer, we still support reading settings the old way by reading configuration data from key-value pairs using configuration sources such as appsettings.json or environment variables:
// Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAdminUI(new AdminUISettings(builder.Configuration));
var app = builder.Build();
app.UseAdminUI();
app.Run();
Also for backwards compatibility, we still support the old version of AddAdminUI
that reads configuration data from key-value pairs using configuration sources such as appsettings.json or environment variables, but this will be deprecated in the future:
// Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddAdminUI(
options =>
{
// Override default options here
}
);
var app = builder.Build();
app.UseAdminUI();
app.Run();
Configuring KeyVault DataProtection
When using KeyVault data protection with AdminUI NuGet package you only need to set the key identifier in the AdminUI settings as the intention is you would configure KeyVault access yourself making the certificates available to AdminUI throuhgh IConfiguration. A simple way of doing this is provided with the Azure.Extensions.AspNetCore.Configuration.Secrets package which provides an extension method called AddAzureKeyVault.
This is why the ClientId
, Vault
, and Secret
are not present in the new AdminUI configuration model.