diff --git a/Models/NotificationConfig.cs b/Models/NotificationConfig.cs index ff934ac..c6819d9 100644 --- a/Models/NotificationConfig.cs +++ b/Models/NotificationConfig.cs @@ -7,6 +7,8 @@ public class NotificationConfig [YamlDotNet.Serialization.YamlMember(Alias = "errors_only")] public bool AppriseNotificationsErrorsOnly { get; set; } = true; [YamlDotNet.Serialization.YamlMember(Alias = "apprise")] - public List AppriseServices { get; set; } = new List(); + public List AppriseServices { get; set; } = new List(); + [YamlDotNet.Serialization.YamlMember(Alias = "include_hostname")] + public bool AppriseNotificationsIncludeHostname { get; set; } = false; } } \ No newline at end of file diff --git a/SARotate.cs b/SARotate.cs index c2dc40f..cc37d31 100644 --- a/SARotate.cs +++ b/SARotate.cs @@ -475,7 +475,9 @@ private async Task SendAppriseNotification(SARotateConfig yamlConfigContent, str { string appriseCommand = $"apprise -vv "; string escapedLogMessage = logMessage.Replace("'", "´").Replace("\"", "´"); - appriseCommand += $"-b '{escapedLogMessage}' "; + string hostName = yamlConfigContent.NotificationConfig.AppriseNotificationsIncludeHostname ? $" on { System.Net.Dns.GetHostName()}" : ""; + + appriseCommand += $"-b '{escapedLogMessage}{hostName}' "; foreach (var appriseService in yamlConfigContent.NotificationConfig.AppriseServices.Where(svc => !string.IsNullOrWhiteSpace(svc))) {