Closed DamianEdwards closed 6 years ago
@Tratcher @muratg
Hmm, I don't think this is a feature we've supported in any middleware yet. We have reloadable config, but do we use it ourselves anywhere? Logging? @haok
We use it in logging for sure, including the Azure App Service integration. In trying this feature is found myself wanting to change the value and have the app honor it.
It shouldn't be too hard to switch the middleware over, just need to hold onto IOptionsMonitor instead of caching the TOptions instance and use monitor.CurrentValue to access the options value.
public HostFilteringMiddleware(RequestDelegate next, ILogger<HostFilteringMiddleware> logger,
IOptionsMonitor<HostFilteringOptions> options)
{
_next = next ?? throw new ArgumentNullException(nameof(next));
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_options = options ?? throw new ArgumentNullException(nameof(options));
}
private HostFilteringOptions Options { get => _options.CurrentValue }
@DamianEdwards Do you want to timebox this (say "Small") in 2.1?
Yeah, it shouldn't be any harder than what @HaoK said plus ensuring the file config added by default flows changes (which I'm sure it already does).
It would be great to be able to change the configured hosts for the app without having to restart it. This likely requires a change in
WebHost
too, around here.