-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (29 loc) · 974 Bytes
/
Copy pathProgram.cs
File metadata and controls
36 lines (29 loc) · 974 Bytes
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
29
30
31
32
33
34
35
36
using AsyncKeyedLock;
using EasyFortniteStats_ImageApi;
using EasyFortniteStats_ImageApi.Middleware;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddMemoryCache();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<SharedAssets>();
builder.Services.AddHttpClient().ConfigureHttpClientDefaults(http =>
{
// Prevent unexpectedly large upstream images from being buffered in managed memory.
http.ConfigureHttpClient(client => client.MaxResponseContentBufferSize = 16 * 1024 * 1024);
});
builder.Services.AddSingleton(new AsyncKeyedLocker<string>(o =>
{
o.PoolSize = 64;
o.PoolInitialFill = -1;
}));
var app = builder.Build();
// Add API Key authentication middleware
app.UseMiddleware<ApiKeyAuthenticationMiddleware>();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.MapControllers();
app.Run();