KafkaSR/RPG.Services.Gateserver/Program.cs

30 lines
976 B
C#
Raw Permalink Normal View History

2024-01-29 23:49:21 +00:00
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using RPG.Services.Core.Extensions;
using RPG.Services.Gateserver.Network.Command;
using RPG.Services.Gateserver.Network.Tcp;
using RPG.Services.Gateserver.Options;
namespace RPG.Services.Gateserver;
internal static class Program
{
private const string GatewayOptionsSectionName = "Gateway";
private static async Task Main(string[] args)
{
Console.Title = "KafkaSR | Gateserver";
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.SetupRPGService<RPGGateserver, GateserverCommandHandler>();
IConfigurationSection gatewaySection = builder.Configuration.GetRequiredSection(GatewayOptionsSectionName);
builder.Services.Configure<GatewayOptions>(gatewaySection)
.AddSingleton<TcpGateway>();
await builder.Build().RunAsync();
}
}