using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using PodNoms.Api.Persistence; using PodNoms.Api.Providers; using PodNoms.Api.Services.Auth; namespace PodNoms.Api { public class Program { static bool isDevelopment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == EnvironmentName.Development; public static void Main(string[] args) { var host = BuildWebHost(args); using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { SeedData.Initialize(services); } catch (Exception ex) { var logger = services.GetRequiredService>(); logger.LogError(ex, "An error occurred seeding the DB."); } } host.Run(); } public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup() .UseUrls("http://0.0.0.0:5000") .UseKestrel(options => { options.Limits.MaxRequestBodySize = 1073741824; }).Build(); } } /* using (var scope = host.Services.CreateScope()) { var services = scope.ServiceProvider; try { var context = services.GetRequiredService(); var userManager = services.GetRequiredService>(); var dbInitializerLogger = services.GetRequiredService>(); DbInitializer.Initialize(context, userManager, dbInitializerLogger).Wait(); } catch (Exception ex) { var logger = services.GetRequiredService>(); logger.LogError(ex, "An error occurred while seeding the database."); } host.MigrateDatabase((isDevelopment || migrate.ToUpper().Equals("TRUE")), drop != null && drop.Equals("TRUE")); } */