DocSpace-client/products/ASC.People/Server/Program.cs

53 lines
1.9 KiB
C#
Raw Normal View History

2019-11-15 08:47:56 +00:00
using System.Collections.Generic;
using System.IO;
2020-07-03 15:57:59 +00:00
2020-11-02 16:27:08 +00:00
using Autofac.Extensions.DependencyInjection;
2020-07-03 15:57:59 +00:00
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
2020-07-03 15:57:59 +00:00
namespace ASC.People
{
public class Program
{
public static void Main(string[] args)
2019-10-21 12:33:02 +00:00
{
2020-07-03 15:57:59 +00:00
CreateHostBuilder(args).Build().Run();
}
2020-09-30 14:47:42 +00:00
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
2020-11-02 16:27:08 +00:00
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
2020-09-30 14:47:42 +00:00
.ConfigureWebHostDefaults(webBuilder =>
{
2020-10-12 19:39:23 +00:00
webBuilder.UseStartup<Startup>();
2020-09-30 14:47:42 +00:00
})
.ConfigureAppConfiguration((hostingContext, config) =>
{
2020-10-12 16:23:15 +00:00
var buided = config.Build();
var path = buided["pathToConf"];
if (!Path.IsPathRooted(path))
{
path = Path.GetFullPath(Path.Combine(hostingContext.HostingEnvironment.ContentRootPath, path));
}
2020-10-12 19:39:23 +00:00
config.SetBasePath(path);
config
2020-10-12 16:23:15 +00:00
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddJsonFile("storage.json")
.AddJsonFile("kafka.json")
.AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddEnvironmentVariables()
2020-11-26 17:30:57 +00:00
.AddCommandLine(args)
.AddInMemoryCollection(new Dictionary<string, string>
{
{"pathToConf", path }
}
);
2020-09-30 14:47:42 +00:00
});
}
2020-07-03 15:57:59 +00:00
}
}