1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-14 14:17:35 -05:00

connection counter

This commit is contained in:
Kyle Spearrin
2018-08-23 15:48:40 -04:00
parent 43e5f300a7
commit d458d77511
5 changed files with 115 additions and 13 deletions

View File

@ -31,12 +31,6 @@ namespace Bit.Notifications
// Settings
var globalSettings = services.AddGlobalSettingsServices(Configuration);
// Repositories
services.AddSqlServerRepositories(globalSettings);
// Context
services.AddScoped<CurrentContext>();
// Identity
services.AddIdentityAuthenticationServices(globalSettings, Environment, config =>
{
@ -63,15 +57,20 @@ namespace Bit.Notifications
services.AddSignalR();
}
services.AddSingleton<IUserIdProvider, SubjectUserIdProvider>();
services.AddSingleton<ConnectionCounter>();
// Mvc
services.AddMvc();
// Hosted Services
if(!globalSettings.SelfHosted &&
CoreHelpers.SettingHasValue(globalSettings.Notifications?.ConnectionString))
if(!globalSettings.SelfHosted)
{
services.AddHostedService<AzureQueueHostedService>();
// Hosted Services
Jobs.JobsHostedService.AddJobsServices(services);
services.AddHostedService<Jobs.JobsHostedService>();
if(CoreHelpers.SettingHasValue(globalSettings.Notifications?.ConnectionString))
{
services.AddHostedService<AzureQueueHostedService>();
}
}
}
@ -105,9 +104,6 @@ namespace Bit.Notifications
app.UseDeveloperExceptionPage();
}
// Default Middleware
app.UseDefaultMiddleware(env);
// Add Cors
app.UseCors(policy => policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader().AllowCredentials());