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

View file

@ -60,11 +60,6 @@ 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)
{
var path = PathEx.ExpandPath(pdnsOptions.Socket);
FileInfo file = new(path);
file.Directory!.Create();
bool isSystemd = false; bool isSystemd = false;
options.UseSystemd(options => options.UseSystemd(options =>
{ {
@ -72,15 +67,17 @@ builder.WebHost.ConfigureKestrel((context, options) =>
options.UseConnectionHandler<PowerDnsHandler>(); options.UseConnectionHandler<PowerDnsHandler>();
}); });
if (!isSystemd) if (!isSystemd && context.Configuration.GetRequiredSection("PowerDns:Listener").Get<PowerDnsListenerOptions>() is { } pdnsOptions)
{ {
var path = PathEx.ExpandPath(pdnsOptions.Socket);
FileInfo file = new(path);
file.Directory!.Create();
file.Delete(); file.Delete();
options.ListenUnixSocket(path, options => options.ListenUnixSocket(path, options =>
{ {
options.UseConnectionHandler<PowerDnsHandler>(); options.UseConnectionHandler<PowerDnsHandler>();
}); });
} }
}
}); });
var app = builder.Build(); var app = builder.Build();