native aot in container
This commit is contained in:
parent
0ca6a91a7e
commit
85ae3e302c
1 changed files with 128 additions and 61 deletions
|
|
@ -11,15 +11,12 @@ using TanksServer.ServicePointDisplay;
|
|||
|
||||
namespace TanksServer;
|
||||
|
||||
internal static class Program
|
||||
public static class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var app = Configure(args);
|
||||
|
||||
app.UseCors();
|
||||
app.UseWebSockets();
|
||||
|
||||
var clientScreenServer = app.Services.GetRequiredService<ClientScreenServer>();
|
||||
var playerService = app.Services.GetRequiredService<PlayerServer>();
|
||||
var controlsServer = app.Services.GetRequiredService<ControlsServer>();
|
||||
|
|
@ -52,10 +49,10 @@ internal static class Program
|
|||
|
||||
using var ws = await context.WebSockets.AcceptWebSocketAsync();
|
||||
await controlsServer.HandleClient(ws, player);
|
||||
return Results.Empty;
|
||||
return Results.Ok();
|
||||
});
|
||||
|
||||
await app.RunAsync();
|
||||
app.Run();
|
||||
}
|
||||
|
||||
private static WebApplication Configure(string[] args)
|
||||
|
|
@ -74,7 +71,7 @@ internal static class Program
|
|||
options.SerializerOptions.TypeInfoResolverChain.Insert(0, new AppSerializerContext());
|
||||
});
|
||||
|
||||
builder.Services.AddOptions();
|
||||
builder.Services.AddHttpLogging(_ => { });
|
||||
|
||||
builder.Services.AddSingleton<MapService>();
|
||||
builder.Services.AddSingleton<BulletManager>();
|
||||
|
|
@ -107,6 +104,12 @@ internal static class Program
|
|||
builder.Services.Configure<ServicePointDisplayConfiguration>(
|
||||
builder.Configuration.GetSection("ServicePointDisplay"));
|
||||
|
||||
return builder.Build();
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseCors();
|
||||
app.UseWebSockets();
|
||||
app.UseHttpLogging();
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in a new issue