You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The configuration name for the MaskinportenSettings object is currently hardcoded at "MaskinportenSettings" in AddMaskinportenClient. Vi have the ability to override this via the ConfigureMaskinportenClient method, but this is perhaps a bit heavy handed in some situations.
Some service owners have many apps running in the same cluster, with the same KeyVault, but require each app to have their own Maskinporten client setup. Which means that the KeyVault entries and appsettings.json configurations are typically prefixed with a unique string (often the app name).
It would be optimal if we could support an app binding to appname-MaskinportenSettings instead of the default hardcoded value.
The manual config done through ConfigureMaskinportenClient can possibly service this purpose, but moves a lot of the configuration out of appsettings.json and in to the codebase itself. Unless there are clever patterns available there to inject values as needed.
Proposed implementation
Create a public method ServiceCollectionExtensions.ConfigureMaskinportenClient that takes a string parameter to pass to IServiceCollection.BindConfiguration.
Calling this method before services.AddAltinnAppServices in Program.cs will result in ServiceCollectionExtensions.AddMaskinportenClient using the newly provided configuration binding instead of the default MaskinportenSettings.
The text was updated successfully, but these errors were encountered:
danielskovli
changed the title
Make MaskinportenSettingsconfiguration name configurable
Make MaskinportenSettingsconfiguration path configurable
Sep 10, 2024
Description
The configuration name for the
MaskinportenSettings
object is currently hardcoded at "MaskinportenSettings" in AddMaskinportenClient. Vi have the ability to override this via the ConfigureMaskinportenClient method, but this is perhaps a bit heavy handed in some situations.Some service owners have many apps running in the same cluster, with the same KeyVault, but require each app to have their own Maskinporten client setup. Which means that the KeyVault entries and appsettings.json configurations are typically prefixed with a unique string (often the app name).
Eg:
appsettings.json
keyvault
It would be optimal if we could support an app binding to
appname-MaskinportenSettings
instead of the default hardcoded value.The manual config done through
ConfigureMaskinportenClient
can possibly service this purpose, but moves a lot of the configuration out of appsettings.json and in to the codebase itself. Unless there are clever patterns available there to inject values as needed.Proposed implementation
Create a public method
ServiceCollectionExtensions.ConfigureMaskinportenClient
that takes astring
parameter to pass toIServiceCollection.BindConfiguration
.Calling this method before
services.AddAltinnAppServices
in Program.cs will result inServiceCollectionExtensions.AddMaskinportenClient
using the newly provided configuration binding instead of the defaultMaskinportenSettings
.The text was updated successfully, but these errors were encountered: