From 8a318f35b76b22c40d28486da4663ed1f6287a76 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 27 Dec 2017 22:39:14 -0500 Subject: [PATCH] events has its own connection string --- src/Api/appsettings.json | 3 +++ src/Billing/appsettings.json | 3 +++ src/Core/GlobalSettings.cs | 1 + src/Core/Repositories/TableStorage/EventRepository.cs | 2 +- .../Services/Implementations/AzureQueueEventWriteService.cs | 2 +- src/Core/Utilities/ServiceCollectionExtensions.cs | 2 +- src/Events/Startup.cs | 2 +- src/Events/appsettings.json | 3 +++ src/Identity/appsettings.json | 3 +++ src/Scim/appsettings.json | 3 +++ 10 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/Api/appsettings.json b/src/Api/appsettings.json index 4773f6f04..f00014a9d 100644 --- a/src/Api/appsettings.json +++ b/src/Api/appsettings.json @@ -26,6 +26,9 @@ "storage": { "connectionString": "SECRET" }, + "events": { + "connectionString": "SECRET" + }, "attachment": { "connectionString": "SECRET", "baseUrl": "http://localhost:4000/attachments/" diff --git a/src/Billing/appsettings.json b/src/Billing/appsettings.json index f4cf9fb95..b4e8f92f8 100644 --- a/src/Billing/appsettings.json +++ b/src/Billing/appsettings.json @@ -26,6 +26,9 @@ "storage": { "connectionString": "SECRET" }, + "events": { + "connectionString": "SECRET" + }, "documentDb": { "uri": "SECRET", "key": "SECRET" diff --git a/src/Core/GlobalSettings.cs b/src/Core/GlobalSettings.cs index a9b7740bc..f1367b472 100644 --- a/src/Core/GlobalSettings.cs +++ b/src/Core/GlobalSettings.cs @@ -17,6 +17,7 @@ namespace Bit.Core public virtual SqlServerSettings SqlServer { get; set; } = new SqlServerSettings(); public virtual MailSettings Mail { get; set; } = new MailSettings(); public virtual StorageSettings Storage { get; set; } = new StorageSettings(); + public virtual StorageSettings Events { get; set; } = new StorageSettings(); public virtual AttachmentSettings Attachment { get; set; } = new AttachmentSettings(); public virtual IdentityServerSettings IdentityServer { get; set; } = new IdentityServerSettings(); public virtual DataProtectionSettings DataProtection { get; set; } = new DataProtectionSettings(); diff --git a/src/Core/Repositories/TableStorage/EventRepository.cs b/src/Core/Repositories/TableStorage/EventRepository.cs index 62f626e7b..8b574376d 100644 --- a/src/Core/Repositories/TableStorage/EventRepository.cs +++ b/src/Core/Repositories/TableStorage/EventRepository.cs @@ -15,7 +15,7 @@ namespace Bit.Core.Repositories.TableStorage private readonly CloudTable _table; public EventRepository(GlobalSettings globalSettings) - : this(globalSettings.Storage.ConnectionString) + : this(globalSettings.Events.ConnectionString) { } public EventRepository(string storageConnectionString) diff --git a/src/Core/Services/Implementations/AzureQueueEventWriteService.cs b/src/Core/Services/Implementations/AzureQueueEventWriteService.cs index 3c6aca07b..8f687475c 100644 --- a/src/Core/Services/Implementations/AzureQueueEventWriteService.cs +++ b/src/Core/Services/Implementations/AzureQueueEventWriteService.cs @@ -22,7 +22,7 @@ namespace Bit.Core.Services IEventRepository eventRepository, GlobalSettings globalSettings) { - var storageAccount = CloudStorageAccount.Parse(globalSettings.Storage.ConnectionString); + var storageAccount = CloudStorageAccount.Parse(globalSettings.Events.ConnectionString); var queueClient = storageAccount.CreateCloudQueueClient(); _queue = queueClient.GetQueueReference("event"); diff --git a/src/Core/Utilities/ServiceCollectionExtensions.cs b/src/Core/Utilities/ServiceCollectionExtensions.cs index 619123945..fd6d0d711 100644 --- a/src/Core/Utilities/ServiceCollectionExtensions.cs +++ b/src/Core/Utilities/ServiceCollectionExtensions.cs @@ -112,7 +112,7 @@ namespace Bit.Core.Utilities services.AddSingleton(); } - if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Storage.ConnectionString)) + if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Events.ConnectionString)) { services.AddSingleton(); } diff --git a/src/Events/Startup.cs b/src/Events/Startup.cs index aec54cc68..f80f2d160 100644 --- a/src/Events/Startup.cs +++ b/src/Events/Startup.cs @@ -64,7 +64,7 @@ namespace Bit.Events // Services services.AddScoped(); - if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Storage.ConnectionString)) + if(!globalSettings.SelfHosted && CoreHelpers.SettingHasValue(globalSettings.Events.ConnectionString)) { services.AddSingleton(); } diff --git a/src/Events/appsettings.json b/src/Events/appsettings.json index 0d06d7dfe..0e6e81572 100644 --- a/src/Events/appsettings.json +++ b/src/Events/appsettings.json @@ -17,6 +17,9 @@ "storage": { "connectionString": "SECRET" }, + "events": { + "connectionString": "SECRET" + }, "documentDb": { "uri": "SECRET", "key": "SECRET" diff --git a/src/Identity/appsettings.json b/src/Identity/appsettings.json index 6a53608fd..5b468984b 100644 --- a/src/Identity/appsettings.json +++ b/src/Identity/appsettings.json @@ -26,6 +26,9 @@ "storage": { "connectionString": "SECRET" }, + "events": { + "connectionString": "SECRET" + }, "documentDb": { "uri": "SECRET", "key": "SECRET" diff --git a/src/Scim/appsettings.json b/src/Scim/appsettings.json index f4cf9fb95..b4e8f92f8 100644 --- a/src/Scim/appsettings.json +++ b/src/Scim/appsettings.json @@ -26,6 +26,9 @@ "storage": { "connectionString": "SECRET" }, + "events": { + "connectionString": "SECRET" + }, "documentDb": { "uri": "SECRET", "key": "SECRET"