Files
Ananta-ps/Ananta.Server/Ananta.App/Program.cs
T

36 lines
1.4 KiB
C#
Raw Normal View History

using Ananta.SDK.Logging;
using Ananta.Server.App;
using Ananta.Server.ClientData.Client4229938;
using Ananta.Server.Configuration;
using Ananta.Server.Protocol.Client4229938;
var (config, configPath) = PrivateServerConfigLoader.Load();
PrivateServerConfigStore.Initialize(config, configPath);
// Hot reload: editing config/private-server.json takes effect without a restart (see MetroGadget).
PrivateServerConfigStore.EnableAutoReload();
// Start the console mirror before the first application log line. Run-All supplies the same
// run id/files to the Node proxy, so both processes land in one console-latest/archive pair.
RuntimeLogs.Initialize(
PrivateServerConfigStore.ResolveProjectPath(config.Logging.Directory),
Environment.GetEnvironmentVariable("DRMK_RUN_ID"),
config.Logging.Console.Enabled,
config.Logging.Packets.Enabled,
config.Logging.Packets.IncludeHex,
config.Logging.Packets.IncludeDecoded,
config.Logging.Packets.MaxBodyBytes);
// Optional economy tables (mall / drops / gacha pools). Loading them here puts the import summary
// in the startup log instead of on the first draw or purchase.
EconomyConfigRepository.Warmup();
TalentTreeRepository.Warmup();
using var shutdown = new CancellationTokenSource();
Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
shutdown.Cancel();
};
await new PrivateServerApplication(config).RunAsync(shutdown.Token);