using Microsoft.AspNetCore.Server.Kestrel.Core;
using AppLibs.Libs;
WSNavigation.LoadJson();
var builder = WebApplication.CreateBuilder(args);

#if (!DEBUG)
	builder.WebHost.UseKestrel(o =>
	{
		o.ListenAnyIP(5102, lo =>
		{
			lo.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
			lo.UseHttps(CertificateStore.GetHTTPSCertificate(), "Pgq95b7r");
		});
	});
	builder.Services.AddControllersWithViews();
#else
	builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
#endif

// Add services to the container.

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
	// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.

	app.UseHsts();

}

app.UseHttpsRedirection();
app.UseStaticFiles();

app.UseRouting();

app.UseAuthorization();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();
