diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs index a982ed1744..56a734ef60 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeServerVariables.cs @@ -37,14 +37,14 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers private readonly LinkGenerator _linkGenerator; private readonly IRuntimeState _runtimeState; private readonly UmbracoFeatures _features; - private readonly GlobalSettings _globalSettings; + private GlobalSettings _globalSettings; private readonly IUmbracoVersion _umbracoVersion; - private readonly ContentSettings _contentSettings; + private ContentSettings _contentSettings; private readonly TreeCollection _treeCollection; private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHostingEnvironment _hostingEnvironment; - private readonly RuntimeSettings _runtimeSettings; - private readonly SecuritySettings _securitySettings; + private RuntimeSettings _runtimeSettings; + private SecuritySettings _securitySettings; private readonly IRuntimeMinifier _runtimeMinifier; private readonly IBackOfficeExternalLoginProviders _externalLogins; private readonly IImageUrlGenerator _imageUrlGenerator; @@ -56,14 +56,14 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers LinkGenerator linkGenerator, IRuntimeState runtimeState, UmbracoFeatures features, - IOptions globalSettings, + IOptionsMonitor globalSettings, IUmbracoVersion umbracoVersion, - IOptions contentSettings, + IOptionsMonitor contentSettings, IHttpContextAccessor httpContextAccessor, TreeCollection treeCollection, IHostingEnvironment hostingEnvironment, - IOptions runtimeSettings, - IOptions securitySettings, + IOptionsMonitor runtimeSettings, + IOptionsMonitor securitySettings, IRuntimeMinifier runtimeMinifier, IBackOfficeExternalLoginProviders externalLogins, IImageUrlGenerator imageUrlGenerator, @@ -74,20 +74,25 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers _linkGenerator = linkGenerator; _runtimeState = runtimeState; _features = features; - _globalSettings = globalSettings.Value; + _globalSettings = globalSettings.CurrentValue; _umbracoVersion = umbracoVersion; - _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings)); + _contentSettings = contentSettings.CurrentValue ?? throw new ArgumentNullException(nameof(contentSettings)); _httpContextAccessor = httpContextAccessor; _treeCollection = treeCollection ?? throw new ArgumentNullException(nameof(treeCollection)); _hostingEnvironment = hostingEnvironment; - _runtimeSettings = runtimeSettings.Value; - _securitySettings = securitySettings.Value; + _runtimeSettings = runtimeSettings.CurrentValue; + _securitySettings = securitySettings.CurrentValue; _runtimeMinifier = runtimeMinifier; _externalLogins = externalLogins; _imageUrlGenerator = imageUrlGenerator; _previewRoutes = previewRoutes; _emailSender = emailSender; _memberPasswordConfigurationSettings = memberPasswordConfigurationSettings.Value; + + globalSettings.OnChange(x => _globalSettings = x); + contentSettings.OnChange(x => _contentSettings = x); + runtimeSettings.OnChange(x => _runtimeSettings = x); + securitySettings.OnChange(x => _securitySettings = x); } /// @@ -487,11 +492,13 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers // exclude anything marked with CoreTreeAttribute var coreTree = treeType.GetCustomAttribute(false); - if (coreTree != null) continue; + if (coreTree != null) + continue; // exclude anything not marked with PluginControllerAttribute var pluginController = treeType.GetCustomAttribute(false); - if (pluginController == null) continue; + if (pluginController == null) + continue; yield return new PluginTree { Alias = tree.TreeAlias, PackageFolder = pluginController.AreaName }; }