Snowflake/RPG.Services.Gateserver/Program.cs

29 lines
978 B
C#

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 = "Snowflake | 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();
}
}