diff --git a/src/Core/GlobalSettings.cs b/src/Core/GlobalSettings.cs
index ba8dc3f86e..9f4e5a0c75 100644
--- a/src/Core/GlobalSettings.cs
+++ b/src/Core/GlobalSettings.cs
@@ -19,7 +19,7 @@ namespace Bit.Core
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 StorageSettings Notifications { get; set; } = new StorageSettings();
+ public virtual NotificationsSettings Notifications { get; set; } = new NotificationsSettings();
public virtual AttachmentSettings Attachment { get; set; } = new AttachmentSettings();
public virtual IdentityServerSettings IdentityServer { get; set; } = new IdentityServerSettings();
public virtual DataProtectionSettings DataProtection { get; set; } = new DataProtectionSettings();
@@ -129,6 +129,11 @@ namespace Bit.Core
public string Dsn { get; set; }
}
+ public class NotificationsSettings : StorageSettings
+ {
+ public string AzureSignalRConnectionString { get; set; }
+ }
+
public class NotificationHubSettings
{
private string _connectionString;
diff --git a/src/Notifications/Notifications.csproj b/src/Notifications/Notifications.csproj
index e73b468b8c..cf96e4086f 100644
--- a/src/Notifications/Notifications.csproj
+++ b/src/Notifications/Notifications.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/Notifications/Startup.cs b/src/Notifications/Startup.cs
index e8c30b78d4..1f96fbe3dd 100644
--- a/src/Notifications/Startup.cs
+++ b/src/Notifications/Startup.cs
@@ -54,7 +54,14 @@ namespace Bit.Notifications
});
// SignalR
- services.AddSignalR();
+ if(!string.IsNullOrWhiteSpace(globalSettings.Notifications?.AzureSignalRConnectionString))
+ {
+ services.AddSignalR().AddAzureSignalR(globalSettings.Notifications.AzureSignalRConnectionString);
+ }
+ else
+ {
+ services.AddSignalR();
+ }
services.AddSingleton();
// Mvc
@@ -103,10 +110,14 @@ namespace Bit.Notifications
app.UseAuthentication();
// Add SignlarR
- app.UseSignalR(routes =>
+ if(!string.IsNullOrWhiteSpace(globalSettings.Notifications?.AzureSignalRConnectionString))
{
- routes.MapHub("/hub");
- });
+ app.UseAzureSignalR(routes => routes.MapHub("/hub"));
+ }
+ else
+ {
+ app.UseSignalR(routes => routes.MapHub("/hub"));
+ }
// Add MVC to the request pipeline.
app.UseMvc();