From e8d9e6d88f75d581bc58a0df9d437fa881c339e5 Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Mon, 3 Mar 2025 14:23:31 +0100 Subject: [PATCH 1/2] Also support `ServiceControl.Audit/IngestAuditMessages` to avoid confusion with other "audit" settings to that have `ServiceControl.Audit` prefix --- .../Infrastructure/Settings/Settings.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs b/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs index c0b1dfb892..a2fb1143f6 100644 --- a/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs +++ b/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs @@ -63,7 +63,15 @@ void LoadAuditQueueInformation() throw new Exception("ServiceBus/AuditQueue value is required to start the instance"); } - IngestAuditMessages = SettingsReader.Read(new SettingsRootNamespace("ServiceControl"), "IngestAuditMessages", true); + var serviceControlNamespace = new SettingsRootNamespace("ServiceControl"); + + if (!SettingsReader.TryRead(SettingsRootNamespace, "IngestAuditMessages", out bool ingestAuditMessages)) + { + // Backwards compatibility + ingestAuditMessages = SettingsReader.Read(serviceControlNamespace, "IngestAuditMessages", true); + } + + IngestAuditMessages = ingestAuditMessages; if (IngestAuditMessages == false) { From e59f772e652bef055d38d03894e6d60054ea63c1 Mon Sep 17 00:00:00 2001 From: Ramon Smits Date: Mon, 10 Mar 2025 11:46:32 +0100 Subject: [PATCH 2/2] Move creation close to only usage --- src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs b/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs index a2fb1143f6..b651804505 100644 --- a/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs +++ b/src/ServiceControl.Audit/Infrastructure/Settings/Settings.cs @@ -63,11 +63,10 @@ void LoadAuditQueueInformation() throw new Exception("ServiceBus/AuditQueue value is required to start the instance"); } - var serviceControlNamespace = new SettingsRootNamespace("ServiceControl"); - if (!SettingsReader.TryRead(SettingsRootNamespace, "IngestAuditMessages", out bool ingestAuditMessages)) { // Backwards compatibility + var serviceControlNamespace = new SettingsRootNamespace("ServiceControl"); ingestAuditMessages = SettingsReader.Read(serviceControlNamespace, "IngestAuditMessages", true); }