2020-08-08 08:53:35 +02:00
|
|
|
|
namespace Giants.Services
|
|
|
|
|
{
|
2020-09-01 20:04:22 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Net.Http.Headers;
|
2020-08-09 01:31:16 +02:00
|
|
|
|
using Giants.Services.Core;
|
2020-08-16 11:03:10 +02:00
|
|
|
|
using Giants.Services.Services;
|
2020-08-10 09:22:33 +02:00
|
|
|
|
using Giants.Services.Store;
|
2020-08-09 11:10:33 +02:00
|
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
2020-08-09 01:31:16 +02:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2020-08-08 08:53:35 +02:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
public static class ServicesModule
|
|
|
|
|
{
|
2020-08-09 01:31:16 +02:00
|
|
|
|
public static void RegisterServices(IServiceCollection services, IConfiguration configuration)
|
2020-08-08 08:53:35 +02:00
|
|
|
|
{
|
|
|
|
|
services.AddSingleton<IServerRegistryService, ServerRegistryService>();
|
2020-08-09 01:31:16 +02:00
|
|
|
|
services.AddSingleton<IServerRegistryStore, CosmosDbServerRegistryStore>();
|
|
|
|
|
services.AddSingleton<IDateTimeProvider, DefaultDateTimeProvider>();
|
2020-08-09 11:10:33 +02:00
|
|
|
|
services.AddSingleton<IMemoryCache, MemoryCache>();
|
2022-09-05 22:42:41 +02:00
|
|
|
|
services.AddSingleton<IVersioningStore, CosmosDbVersioningStore>();
|
|
|
|
|
services.AddSingleton<IVersioningService, VersioningService>();
|
2020-08-16 12:08:49 +02:00
|
|
|
|
services.AddSingleton<ICommunityService, CommunityService>();
|
2020-09-01 07:46:07 +02:00
|
|
|
|
services.AddSingleton<ICrashReportService, CrashReportService>();
|
2020-08-09 02:26:41 +02:00
|
|
|
|
|
2020-08-09 02:52:26 +02:00
|
|
|
|
services.AddHostedService<InitializerService>();
|
2020-08-09 02:26:41 +02:00
|
|
|
|
services.AddHostedService<ServerRegistryCleanupService>();
|
2020-09-01 20:04:22 +02:00
|
|
|
|
|
|
|
|
|
services.AddHttpClient("Sentry", c =>
|
|
|
|
|
{
|
|
|
|
|
c.BaseAddress = new Uri(configuration["SentryBaseUri"]);
|
|
|
|
|
|
|
|
|
|
string sentryAuthenticationToken = configuration["SentryAuthenticationToken"];
|
|
|
|
|
c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", sentryAuthenticationToken);
|
|
|
|
|
});
|
2020-08-08 08:53:35 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|