refactor
This commit is contained in:
parent
65b6bf9141
commit
f4c75f91f4
@ -68,7 +68,8 @@ global using Microsoft.AspNetCore.Routing.Patterns;
|
||||
global using Microsoft.Extensions.Configuration;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
global using Microsoft.Extensions.Hosting;
|
||||
global using Microsoft.Extensions.Hosting;
|
||||
global using Microsoft.Extensions.Hosting.WindowsServices;
|
||||
global using Microsoft.Extensions.Logging;
|
||||
global using Microsoft.Extensions.Options;
|
||||
global using Microsoft.Extensions.Primitives;
|
||||
|
@ -12,54 +12,10 @@ builder.Host.UseWindowsService();
|
||||
builder.Host.UseSystemd();
|
||||
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
|
||||
|
||||
builder.WebHost.ConfigureKestrel((hostingContext, serverOptions) =>
|
||||
{
|
||||
var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel");
|
||||
|
||||
if (!kestrelConfig.Exists()) return;
|
||||
|
||||
var unixSocket = kestrelConfig.GetValue<string>("ListenUnixSocket");
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(unixSocket))
|
||||
{
|
||||
unixSocket = string.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", ""));
|
||||
|
||||
serverOptions.ListenUnixSocket(unixSocket);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.WebHost.ConfigureDefaultKestrel();
|
||||
|
||||
builder.Host.ConfigureDefaultAppConfiguration(args);
|
||||
|
||||
//builder.Host.ConfigureAppConfiguration((hostContext, config) =>
|
||||
//{
|
||||
// var buided = config.Build();
|
||||
// var path = buided["pathToConf"];
|
||||
// if (!Path.IsPathRooted(path))
|
||||
// {
|
||||
// path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
// }
|
||||
// config.SetBasePath(path);
|
||||
// config
|
||||
// .AddJsonFile("appsettings.json")
|
||||
// .AddJsonFile($"appsettings.{hostContext.HostingEnvironment.EnvironmentName}.json", true)
|
||||
// .AddJsonFile("storage.json")
|
||||
// .AddJsonFile("kafka.json")
|
||||
// .AddJsonFile($"kafka.{hostContext.HostingEnvironment.EnvironmentName}.json", true)
|
||||
// .AddJsonFile("redis.json")
|
||||
// .AddJsonFile($"redis.{hostContext.HostingEnvironment.EnvironmentName}.json", true)
|
||||
// .AddEnvironmentVariables()
|
||||
// .AddCommandLine(args)
|
||||
// .AddInMemoryCollection(new Dictionary<string, string>
|
||||
// {
|
||||
// {"pathToConf", path }
|
||||
// }
|
||||
// );
|
||||
|
||||
//});
|
||||
|
||||
builder.Host.ConfigureNLogLogging();
|
||||
|
||||
var startup = new Startup(builder.Configuration, builder.Environment);
|
||||
|
Loading…
Reference in New Issue
Block a user