2018-10-26 07:22:53 +02:00
|
|
|
|
using Microsoft.AspNetCore;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
2021-07-01 06:56:12 +02:00
|
|
|
|
using Microsoft.Extensions.Hosting;
|
2019-08-04 23:13:40 +02:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2021-07-01 06:56:12 +02:00
|
|
|
|
using Microsoft.Extensions.Logging.Console;
|
|
|
|
|
using System;
|
2019-08-04 23:13:40 +02:00
|
|
|
|
using System.IO;
|
|
|
|
|
using Teknik.Configuration;
|
|
|
|
|
using Teknik.Logging;
|
2018-10-26 07:22:53 +02:00
|
|
|
|
|
|
|
|
|
namespace Teknik.IdentityServer
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
2021-07-01 06:56:12 +02:00
|
|
|
|
AppContext.SetSwitch("Microsoft.AspNetCore.Routing.UseCorrectCatchAllBehavior",
|
|
|
|
|
true);
|
|
|
|
|
CreateHostBuilder(args).Build().Run();
|
2018-10-26 07:22:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-01 06:56:12 +02:00
|
|
|
|
public static IHostBuilder CreateHostBuilder(string[] args)
|
2018-10-26 07:22:53 +02:00
|
|
|
|
{
|
|
|
|
|
|
2021-07-01 06:56:12 +02:00
|
|
|
|
return Host.CreateDefaultBuilder(args)
|
|
|
|
|
.ConfigureAppConfiguration(config =>
|
|
|
|
|
{
|
|
|
|
|
config.AddJsonFile("appsettings.json", optional: true);
|
|
|
|
|
config.AddCommandLine(args);
|
|
|
|
|
})
|
|
|
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
|
|
|
{
|
|
|
|
|
webBuilder.UseStartup<Startup>();
|
|
|
|
|
})
|
2019-08-04 23:13:40 +02:00
|
|
|
|
.ConfigureLogging((hostingContext, logging) =>
|
|
|
|
|
{
|
|
|
|
|
string baseDir = hostingContext.HostingEnvironment.ContentRootPath;
|
|
|
|
|
string dataDir = Path.Combine(baseDir, "App_Data");
|
|
|
|
|
logging.AddProvider(new LoggerProvider(Config.Load(dataDir)));
|
2021-07-01 06:56:12 +02:00
|
|
|
|
logging.AddFilter<ConsoleLoggerProvider>("Microsoft.AspNetCore.Routing", LogLevel.Trace);
|
|
|
|
|
});
|
2018-10-26 07:22:53 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|