Open Piedone opened 1 year ago
A good example is Lombiq.Hosting.Azure.ApplicationInsights. I'd like to enable this in prod but not in staging.
Note that Feature Profiles are about allowing certain modules/features for certain tenants, not about enabling them. You need Feature Profiles if you want admin users of given tenants to not see certain modules.
However, if you want to conditionally enable a feature, you can do that along these lines in your Program.cs:
var builder = WebApplication.CreateBuilder(args);
...
builder.Services
.AddOrchardCms(orchardCoreBuilder =>
{
if (...)
{
orchardCoreBuilder.AddTenantFeatures("Lombiq.Hosting.Azure.ApplicationInsights");
}
});
And thanks for using our module!
Note that Feature Profiles are about allowing certain modules/features for certain tenants, not about enabling them. You need Feature Profiles if you want admin users of given tenants to not see certain modules.
However, if you want to conditionally enable a feature, you can do that along these lines in your Program.cs:
var builder = WebApplication.CreateBuilder(args); ... builder.Services .AddOrchardCms(orchardCoreBuilder => { if (...) { orchardCoreBuilder.AddTenantFeatures("Lombiq.Hosting.Azure.ApplicationInsights"); } });
And thanks for using our module!
Excellent! Thanks for the clarification and thanks for the module!
Is your feature request related to a problem? Please describe.
Tenant feature profiles are stored in a single document in the DB. While this makes it possible to change the configuration from the admin, it also necessitates this. Having environment-specific configuration is thus hard to achieve, and getting changes implemented during development time out to a production environment needs either manual updates or something like migrations.
Describe the solution you'd like
This suggestion is about adding the ability to, in addition to the existing DB-based admin configuration, set this configuration from configuration providers. I.e., do what e.g.
OrchardCore.Email
does withSmtpSettings
:SmtpSettingsConfiguration
), but can be optionally overridden fromIShellConfiguration
(ConfigureEmailSettings()
).IOptions<TConfig>
(SmtpService
).Describe alternatives you've considered
Workarounds like the mentioned migrations approach are available, but to set such configuration in a flexible manner, the one approach is really such a configuration provider-based approach.