Moved configuration setting POCOs into Umbraco.Core and adjusted references.
Amended injection of some settings to use IOptionsSnapshot.
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
using System.Net.Mail;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.HealthChecks;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Configuration.Models;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Web.HealthCheck.NotificationMethods
|
||||
@@ -18,9 +18,15 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
|
||||
private readonly IRequestAccessor _requestAccessor;
|
||||
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IContentSettings _contentSettings;
|
||||
private readonly ContentSettings _contentSettings;
|
||||
|
||||
public EmailNotificationMethod(ILocalizedTextService textService, IRequestAccessor requestAccessor, IGlobalSettings globalSettings, IHealthChecksSettings healthChecksSettings, IContentSettings contentSettings) : base(healthChecksSettings)
|
||||
public EmailNotificationMethod(
|
||||
ILocalizedTextService textService,
|
||||
IRequestAccessor requestAccessor,
|
||||
IGlobalSettings globalSettings,
|
||||
IHealthChecksSettings healthChecksSettings,
|
||||
IOptionsSnapshot<ContentSettings> contentSettings)
|
||||
: base(healthChecksSettings)
|
||||
{
|
||||
var recipientEmail = Settings?["recipientEmail"]?.Value;
|
||||
if (string.IsNullOrWhiteSpace(recipientEmail))
|
||||
@@ -34,7 +40,7 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
|
||||
_textService = textService ?? throw new ArgumentNullException(nameof(textService));
|
||||
_requestAccessor = requestAccessor;
|
||||
_globalSettings = globalSettings;
|
||||
_contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings));
|
||||
_contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
|
||||
}
|
||||
|
||||
public string RecipientEmail { get; }
|
||||
@@ -73,7 +79,7 @@ namespace Umbraco.Web.HealthCheck.NotificationMethods
|
||||
|
||||
private MailMessage CreateMailMessage(string subject, string message)
|
||||
{
|
||||
var to = _contentSettings.NotificationEmailAddress;
|
||||
var to = _contentSettings.Notifications.NotificationEmailAddress;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(subject))
|
||||
subject = "Umbraco Health Check Status";
|
||||
|
||||
Reference in New Issue
Block a user