Aguacongas.DynamicConfiguration.Razor
                              
                            
                                2.0.0
                            
                        
                    dotnet add package Aguacongas.DynamicConfiguration.Razor --version 2.0.0
NuGet\Install-Package Aguacongas.DynamicConfiguration.Razor -Version 2.0.0
<PackageReference Include="Aguacongas.DynamicConfiguration.Razor" Version="2.0.0" />
<PackageVersion Include="Aguacongas.DynamicConfiguration.Razor" Version="2.0.0" />
<PackageReference Include="Aguacongas.DynamicConfiguration.Razor" />
paket add Aguacongas.DynamicConfiguration.Razor --version 2.0.0
#r "nuget: Aguacongas.DynamicConfiguration.Razor, 2.0.0"
#:package Aguacongas.DynamicConfiguration.Razor@2.0.0
#addin nuget:?package=Aguacongas.DynamicConfiguration.Razor&version=2.0.0
#tool nuget:?package=Aguacongas.DynamicConfiguration.Razor&version=2.0.0
Aguacongas.DynamicConfiguration.Razor
Razor components to configure your .NET application dymamically.
Usage
Setup
Using a Blazor application.
You need to define a class to bind to your whole configuration:
/// <summary>
/// Defines the configuration we can override
/// </summary>
public class ServerConfig
{
    /// <summary>
    /// Gets or sets the reverse proxy configuration
    /// </summary>
    public ProxyConfig? ReverseProxy { get; set; }
    /// <summary>
    /// Gets or sets the logging configuration
    /// </summary>
    public LoggingConfig? Logging { get; set; }
}
This class must be shared by the blazor application and the web API.
The Blazor app appsettings.json should contains a SettingsOptions:
{
  "SettingsOptions": {
    "TypeName": "Yarp.Configuration.Model.ServerConfig, Yarp.Configuration",
    "ApiUrl": "https://localhost:7035/api/configuration"
  }
}
The Program.cs can look like:
using Aguacongas.DynamicConfiguration.Razor;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Yarp.AdminBlazorApp;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
var rootComponents = builder.RootComponents;
rootComponents.Add<App>("#app");
rootComponents.Add<HeadOutlet>("head::after");
var services = builder.Services;
var configuration = builder.Configuration;
// The Settings components requires authentication.
// Update this code with the remote authorization service of your choice
services.AddOidcAuthentication(options => 
{
    options.ProviderOptions.Authority = builder.HostEnvironment.BaseAddress;
});
// Configure the httpClientBuilder to meet your requirement by adding an authorization message handler.
var httpClientBuilder = services.AddConfigurationService(configuration.GetSection("SettingsOptions"));
services.AddAuthorizationCore(options =>
{
    // The Settings component requires the policiy, DYNAMIC_CONFIGURATION_WRITTER_POLICY
    // In this sample this policy requires nothing, all users can save data.
    // You should update this code to meet your requirement.
    options.AddPolicy(Settings.DYNAMIC_CONFIGURATION_WRITTER_POLICY,
        builder => builder.RequireAssertion(context => true));
});
await builder.Build().RunAsync();
Review the Yarp.AdminBlazorApp sample.
Localization
The library contains localized string resources used by components :
| key | value | 
|---|---|
| Create | Créer | 
| delete | supprimer | 
| Edit | Editer | 
| key | clé | 
| Save | Sauver | 
Only emglish and french resources are provided at the moments,
but you can provide your resources in yours languages by implementing ISettingsLocalizer
and providing the implementation in the DI:
public class SettingsLocalizer : ISettingsLocalizer
{
    private readonly IStringLocalizer<Settings> _stringLocalizer;
    public SettingsLocalizer(IStringLocalizer<Settings> stringLocalizer)
    {
        _stringLocalizer = stringLocalizer ?? throw new ArgumentNullException(nameof(stringLocalizer));
    }
    public LocalizedString this[string name] => _stringLocalizer[name];
}
 services.AddScoped<ISettingsLocalizer, SettingsLocalizer>();
                                | Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. | 
- 
                                                    
net8.0
- Microsoft.AspNetCore.Components.Authorization (>= 8.0.0)
 - Microsoft.AspNetCore.Components.Web (>= 8.0.0)
 - Microsoft.Extensions.Configuration.Binder (>= 8.0.0)
 - Microsoft.Extensions.Http (>= 8.0.0)
 - Microsoft.Extensions.Localization (>= 8.0.0)
 
 
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Aguacongas.DynamicConfiguration.Razor:
| Package | Downloads | 
|---|---|
| 
                                                        
                                                            Aguacongas.TheIdServer.BlazorApp.Infrastructure
                                                        
                                                         TheIdServer administration application models, services, validators and extensions.  | 
                                                    
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Aguacongas.DynamicConfiguration.Razor:
| Repository | Stars | 
|---|---|
| 
                                                        
                                                            Aguafrommars/TheIdServer
                                                        
                                                         
                                                            OpenID/Connect, OAuth2, WS-Federation and SAML 2.0 server based on Duende IdentityServer and ITFoxtec Identity SAML 2.0 with its admin UI
                                                         
                                                     | 
                                                    
| Version | Downloads | Last Updated | 
|---|---|---|
| 2.0.0 | 12,961 | 11/24/2023 | 
| 2.0.0-preview1-0080 | 1,424 | 10/4/2023 | 
| 1.0.1 | 16,843 | 2/2/2023 | 
| 1.0.1-preview1-0044 | 525 | 2/2/2023 | 
| 1.0.1-preview1-0037 | 516 | 2/1/2023 | 
| 1.0.0 | 114,904 | 12/25/2021 | 
| 1.0.0-preview1-0057 | 603 | 12/23/2021 | 
| 1.0.0-preview1-0056 | 592 | 12/23/2021 |