forked from jberlyn/kosync-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
executable file
·38 lines (21 loc) · 759 Bytes
/
Program.cs
File metadata and controls
executable file
·38 lines (21 loc) · 759 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
37
38
using System.Net;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpContextAccessor();
builder.Services.AddSingleton<ProxyService, ProxyService>();
builder.Services.AddScoped<IPService, IPService>();
builder.Services.AddScoped<UserService, UserService>();
// Změna na Singleton: Databáze se inicializuje pouze jednou při startu
builder.Services.AddSingleton<KosyncDb, KosyncDb>();
builder.Services.AddControllers();
if (Environment.GetEnvironmentVariable("SINGLE_LINE_LOGGING") == "true")
{
builder.Logging.ClearProviders();
builder.Logging.AddSimpleConsole(options =>
{
options.SingleLine = true;
});
}
var app = builder.Build();
app.UseForwardedHeaders();
app.MapControllers();
app.Run();