This commit is contained in:
Jöran Malek 2024-01-13 21:15:14 +01:00
parent 58020c81c9
commit f61eba0fdd

View file

@ -60,26 +60,23 @@ builder.Services.Configure<SocketTransportOptions>(options =>
builder.WebHost.ConfigureKestrel((context, options) => builder.WebHost.ConfigureKestrel((context, options) =>
{ {
if (context.Configuration.GetSection("PowerDns:Listener").Get<PowerDnsListenerOptions>() is { } pdnsOptions) bool isSystemd = false;
options.UseSystemd(options =>
{
isSystemd = true;
options.UseConnectionHandler<PowerDnsHandler>();
});
if (!isSystemd && context.Configuration.GetRequiredSection("PowerDns:Listener").Get<PowerDnsListenerOptions>() is { } pdnsOptions)
{ {
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();
bool isSystemd = false; file.Delete();
options.UseSystemd(options => options.ListenUnixSocket(path, options =>
{ {
isSystemd = true;
options.UseConnectionHandler<PowerDnsHandler>(); options.UseConnectionHandler<PowerDnsHandler>();
}); });
if (!isSystemd)
{
file.Delete();
options.ListenUnixSocket(path, options =>
{
options.UseConnectionHandler<PowerDnsHandler>();
});
}
} }
}); });