Review
This commit is contained in:
parent
58020c81c9
commit
f61eba0fdd
1 changed files with 10 additions and 13 deletions
|
|
@ -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>();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue