Skip to content

Integrate Settings Spa Client Module

A Spa client module is provided to contribute into the SPA configuration with the frontend settings within the known modules.

The implementation of this module is quite simple, we just need to add the csproj reference and depends on the SettingsSpaClientModule.

XML
<ProjectReference Include="$(ServicesPath)Settings\ITsynch.Suite.Settings.Spa.ClientModule\ITsynch.Suite.Settings.Spa.ClientModule.csproj" />
C#
1
2
3
4
5
6
7
8
9
public class AdminCenterBffModule : SuiteAspNetApplicationModule
{
    public override void SetupModule(IModuleBuilder builder)
    {
        base.SetupModule(builder);

        builder.DependsOn<SettingsSpaClientModule>();
    }
}

This client module will retrieve the available settings with request/response using an specific-known routing key between the Bff and the Application service.

Let's clarify this with an example: Suppose that we have the AdminCenterApplication module and the AdminCenterBffModule. Settings will automatically set a well-known routing key using the current runtime environment and removing the application or bff suffix as appropriate. The resulting well-known routing key will be 'ITsynch.AdminCenter'.

In the case that Application and Bff have different names, like AdminBffModule and AdminCarnivalModule, SettingsClientModule supports setting a custom runtime name:

C#
public class AdminCarnivalModule : SuiteAspNetApplicationModule
{
    public override void SetupModule(IModuleBuilder builder)
    {
        base.SetupModule(builder);

        builder.DependsOn<SettingsClientModule, SettingsClientModuleOptions>(opts =>
        {
            opts.SetDbContext<AdminDbContext>();
            opts.SetCustomRuntimeName("ITsynch.Admin");
        });
    }
}