2019-08-06 16:10:39 +02:00
|
|
|
using Autofac.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
using Ordering.BackgroundTasks.Extensions;
|
|
|
|
using Ordering.BackgroundTasks.Tasks;
|
|
|
|
using Serilog;
|
|
|
|
using System.IO;
|
2019-08-07 15:45:23 +02:00
|
|
|
using Microsoft.AspNetCore;
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
2019-08-06 16:10:39 +02:00
|
|
|
|
|
|
|
namespace Ordering.BackgroundTasks
|
|
|
|
{
|
|
|
|
public class Program
|
|
|
|
{
|
2019-11-07 18:22:23 +00:00
|
|
|
public static readonly string Namespace = typeof(Program).Namespace;
|
|
|
|
public static readonly string AppName = Namespace;
|
|
|
|
|
2019-08-06 16:10:39 +02:00
|
|
|
public static void Main(string[] args)
|
|
|
|
{
|
2019-08-07 15:45:23 +02:00
|
|
|
CreateHostBuilder(args).Run();
|
2019-08-06 16:10:39 +02:00
|
|
|
}
|
|
|
|
|
2019-08-07 15:45:23 +02:00
|
|
|
public static IWebHost CreateHostBuilder(string[] args) =>
|
|
|
|
WebHost.CreateDefaultBuilder(args)
|
2019-08-07 09:28:08 +02:00
|
|
|
.ConfigureAppConfiguration((host, builder) =>
|
2019-08-06 16:10:39 +02:00
|
|
|
{
|
|
|
|
builder.SetBasePath(Directory.GetCurrentDirectory());
|
|
|
|
builder.AddJsonFile("appsettings.json", optional: true);
|
2019-08-07 09:28:08 +02:00
|
|
|
builder.AddJsonFile($"appsettings.{host.HostingEnvironment.EnvironmentName}.json", optional: true);
|
2019-08-06 16:10:39 +02:00
|
|
|
builder.AddEnvironmentVariables();
|
|
|
|
builder.AddCommandLine(args);
|
|
|
|
})
|
|
|
|
.ConfigureLogging((host, builder) => builder.UseSerilog(host.Configuration).AddSerilog())
|
2019-08-07 15:45:23 +02:00
|
|
|
.UseStartup<Startup>()
|
|
|
|
.Build();
|
2019-08-06 16:10:39 +02:00
|
|
|
}
|
|
|
|
}
|