1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-25 07:35:36 +01:00
GiantsTools/Giants.Services/Core/ServicesModule.cs

38 lines
1.6 KiB
C#
Raw Normal View History

namespace Giants.Services
{
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;
using Giants.Services.Store;
using Microsoft.Extensions.Caching.Memory;
2020-08-09 01:31:16 +02:00
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
public static class ServicesModule
{
2020-08-09 01:31:16 +02:00
public static void RegisterServices(IServiceCollection services, IConfiguration configuration)
{
services.AddSingleton<IServerRegistryService, ServerRegistryService>();
2020-08-09 01:31:16 +02:00
services.AddSingleton<IServerRegistryStore, CosmosDbServerRegistryStore>();
services.AddSingleton<IDateTimeProvider, DefaultDateTimeProvider>();
services.AddSingleton<IMemoryCache, MemoryCache>();
services.AddSingleton<IUpdaterStore, CosmosDbUpdaterStore>();
services.AddSingleton<IUpdaterService, UpdaterService>();
services.AddSingleton<ICommunityService, CommunityService>();
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>();
services.AddHttpClient("Sentry", c =>
{
c.BaseAddress = new Uri(configuration["SentryBaseUri"]);
string sentryAuthenticationToken = configuration["SentryAuthenticationToken"];
c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", sentryAuthenticationToken);
});
}
}
}