Systemd Socket Activation

This commit is contained in:
Jöran Malek 2024-01-13 17:46:11 +01:00
parent 99202af871
commit 3a30daf597

View file

@ -65,10 +65,21 @@ builder.WebHost.ConfigureKestrel((context, options) =>
var path = PathEx.ExpandPath(pdnsOptions.Socket); var path = PathEx.ExpandPath(pdnsOptions.Socket);
FileInfo file = new(path); FileInfo file = new(path);
file.Directory!.Create(); file.Directory!.Create();
options.ListenUnixSocket(path, options => bool isSystemd = false;
options.UseSystemd(options =>
{ {
isSystemd = true;
options.UseConnectionHandler<PowerDnsHandler>(); options.UseConnectionHandler<PowerDnsHandler>();
}); });
if (!isSystemd)
{
file.Delete();
options.ListenUnixSocket(path, options =>
{
options.UseConnectionHandler<PowerDnsHandler>();
});
}
} }
}); });