DocSpace-client/web/ASC.Web.Api/Program.cs

39 lines
1.3 KiB
C#
Raw Normal View History

2019-05-15 14:56:09 +00:00
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
2019-05-28 15:05:20 +00:00
using Microsoft.Extensions.Configuration;
2019-06-21 08:03:42 +00:00
using System.IO;
2019-05-28 15:05:20 +00:00
2019-05-15 14:56:09 +00:00
namespace ASC.Web.Api
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
2019-05-28 15:05:20 +00:00
})
.ConfigureAppConfiguration((hostingContext, config) => {
2019-06-21 08:03:42 +00:00
var buided = config.Build();
var path = buided["pathToConf"];
if (!Path.IsPathRooted(path))
{
path = Path.GetFullPath(Path.Combine(hostingContext.HostingEnvironment.ContentRootPath, path));
}
config.SetBasePath(path);
config
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
.AddJsonFile("autofac.json")
.AddJsonFile("autofac.products.json")
2019-06-21 08:03:42 +00:00
.AddJsonFile("storage.json");
2019-05-28 15:05:20 +00:00
});
2019-05-15 14:56:09 +00:00
}
}