summary refs log tree commit diff
path: root/extra/admin-api/Utilities/Spacebar.Cdn.Fsck/Program.cs
blob: 15822cc95a643b3f83b7fc9e9ab060e3c74f7142 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using ArcaneLibs;
using Microsoft.EntityFrameworkCore;
using Spacebar.Cdn.Fsck;
using Spacebar.Interop.Cdn.Abstractions;
using Spacebar.Models.Db.Contexts;

var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddSingleton<IFileSource>(new ProxyFileSource("http://cdn.old.server.spacebar.chat"));
builder.Services.AddSingleton<LruFileCache>(new LruFileCache(1*1024*1024*1024));
builder.Services.AddHostedService<FsckService>();

builder.Services.AddDbContextPool<SpacebarDbContext>(options => {
    options
        .UseNpgsql(builder.Configuration.GetConnectionString("Spacebar"))
        .EnableDetailedErrors();
});

StreamingHttpClient.LogRequests = false;

var host = builder.Build();
host.Start();