-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
28 lines (21 loc) · 1001 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using RealistikOsu.Cron;
using RealistikOsu.Cron.Context;
using RealistikOsu.Cron.Repositories;
using StackExchange.Redis;
var builder = Host.CreateApplicationBuilder(args);
DotEnv.Load(Path.Combine(Directory.GetCurrentDirectory(), ".env"));
builder.Configuration.AddEnvironmentVariables();
var redisConnectionMultiplexer = ConnectionMultiplexer.Connect(new ConfigurationOptions
{
EndPoints = { builder.Configuration["RedisUri"] }
});
builder.Services.AddSingleton(redisConnectionMultiplexer);
builder.Services.AddSingleton<DapperContext>();
builder.Services.AddSingleton<IUserRepository, UserRepository>();
builder.Services.AddSingleton<IFirstPlaceRepository, FirstPlaceRepository>();
builder.Services.AddSingleton<IScoreRepository, ScoreRepository>();
builder.Services.AddSingleton<IUserBadgeRepository, UserBadgeRepository>();
builder.Services.AddSingleton<IUserStatsRepository, UserStatsRepository>();
builder.Services.AddHostedService<Worker>();
var host = builder.Build();
host.Run();