mirror of
https://github.com/bitwarden/server.git
synced 2024-12-31 18:27:49 +01:00
add support for azuresignalr services
This commit is contained in:
parent
6a2e64f2a0
commit
d992125b5f
@ -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;
|
||||
|
@ -10,6 +10,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.Azure.SignalR" Version="1.0.0-preview1-10015" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -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<IUserIdProvider, SubjectUserIdProvider>();
|
||||
|
||||
// Mvc
|
||||
@ -103,10 +110,14 @@ namespace Bit.Notifications
|
||||
app.UseAuthentication();
|
||||
|
||||
// Add SignlarR
|
||||
app.UseSignalR(routes =>
|
||||
if(!string.IsNullOrWhiteSpace(globalSettings.Notifications?.AzureSignalRConnectionString))
|
||||
{
|
||||
routes.MapHub<NotificationsHub>("/hub");
|
||||
});
|
||||
app.UseAzureSignalR(routes => routes.MapHub<NotificationsHub>("/hub"));
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseSignalR(routes => routes.MapHub<NotificationsHub>("/hub"));
|
||||
}
|
||||
|
||||
// Add MVC to the request pipeline.
|
||||
app.UseMvc();
|
||||
|
Loading…
Reference in New Issue
Block a user