This repository has been archived on 2023-10-28. You can view files and clone it, but cannot push or open issues or pull requests.
pwt-0x01-ng/Program.cs

40 lines
1.1 KiB
C#
Raw Normal View History

using System.Threading.Tasks;
2020-10-26 21:58:35 +01:00
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
2021-02-10 03:26:37 +01:00
using Microsoft.Extensions.Logging;
using pwt_0x01_ng.Models.Database;
2020-10-26 21:58:35 +01:00
namespace pwt_0x01_ng
{
2020-12-28 14:50:19 +01:00
public class Program
{
merge: feature-add-identity commit 47c8a3e8e27fb8a71e702232c681d588fa152bc0 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:58:07 2021 +0100 chore: register and login on the right commit 3e32cd61c2436123887d78f4ae396577b378e53c Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:43:07 2021 +0100 chore: add {Login,Register}ViewModel commit f82f12a5328f1500c3a58dccb3728dc86d1cc92c Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:30:36 2021 +0100 chore: libs and pkgs version bump commit 202b06505c94817c7bc60b432a9320efce80afac Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:29:40 2021 +0100 chore: local post-kaniko convenience chown * [skip ci] commit 7e4c4ccbbf4f7290d47c4c682f09ee508b34ae1e Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:29:15 2021 +0100 chore: add Manager on app start commit 62e9d567c07794b821eb86e7dcff4ecbb6bbd47e Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:12:24 2021 +0100 chore: add Login page * include FontAwesome (atm from CDN, will fetch it later and bundle it here) commit 3c899a2d024d8b74c7e28dfd4b86e1332d964129 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 13:33:32 2021 +0100 fix: use proper service provider commit 88a6e0f45eae7d71cf352d01a693429246effd98 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 12:26:41 2021 +0100 chore: do creation async + s/FirstName/Name/ commit eaed0ec13c0dd3824802a698ac9ed30bffc52de9 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 10:55:23 2021 +0100 fix: err creating admin * cause of silly passwd requirements - require {upper,lower}case and non-alphanumeric characters is implicitly set to true commit f55f8517f8f8516192b5d156c71596e7fcc55ad2 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 23:11:06 2021 +0100 feat: table renames+call role-creating methods * no "AspNet" prefix * actually call Ensure{Admin,Roles}Created on app start commit 20d3458f281ec9478dc9b0fab3795556dcd0a78f Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 22:05:11 2021 +0100 fix typo: DbContext --> DBContext commit f972ac83e7197813bf4c9b4d9bb44d640b5dd071 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 20:55:22 2021 +0100 chore: add login and usr mgmt logic * add login and registration views * add methods to create admin user on app start commit b65a6d21f8dc5227a8da2d5040348e269c2f3711 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 16:02:33 2021 +0100 chore: add auth options * FIXME dev fun settings need to be replaced with proper settings commit 8f84939c22ec96e0a143350b9b9ba3d738dfc149 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 14:54:57 2021 +0100 chore: adding identity roles (batch 1) * preparing Startup and DBContext to work with roles and auth * added Roles enum * added User model * added Microsoft.AspNetCore.Identity.EntityFrameworkCore v3.1.10 nuget * note: auth is not ready and working yet, this is batch one of the preparations
2021-01-28 15:27:25 +01:00
public static async Task Main(string[] args)
2020-12-28 14:50:19 +01:00
{
IWebHost webHost = CreateWebHostBuilder(args).Build();
using (var scope = webHost.Services.CreateScope())
{
var serviceProvider = scope.ServiceProvider;
var dbctx = serviceProvider.GetRequiredService<DBContext>();
DBInit.Init(dbctx);
merge: feature-add-identity commit 47c8a3e8e27fb8a71e702232c681d588fa152bc0 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:58:07 2021 +0100 chore: register and login on the right commit 3e32cd61c2436123887d78f4ae396577b378e53c Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:43:07 2021 +0100 chore: add {Login,Register}ViewModel commit f82f12a5328f1500c3a58dccb3728dc86d1cc92c Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:30:36 2021 +0100 chore: libs and pkgs version bump commit 202b06505c94817c7bc60b432a9320efce80afac Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:29:40 2021 +0100 chore: local post-kaniko convenience chown * [skip ci] commit 7e4c4ccbbf4f7290d47c4c682f09ee508b34ae1e Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:29:15 2021 +0100 chore: add Manager on app start commit 62e9d567c07794b821eb86e7dcff4ecbb6bbd47e Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 14:12:24 2021 +0100 chore: add Login page * include FontAwesome (atm from CDN, will fetch it later and bundle it here) commit 3c899a2d024d8b74c7e28dfd4b86e1332d964129 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 13:33:32 2021 +0100 fix: use proper service provider commit 88a6e0f45eae7d71cf352d01a693429246effd98 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 12:26:41 2021 +0100 chore: do creation async + s/FirstName/Name/ commit eaed0ec13c0dd3824802a698ac9ed30bffc52de9 Author: surtur <a_mirre@utb.cz> Date: Thu Jan 28 10:55:23 2021 +0100 fix: err creating admin * cause of silly passwd requirements - require {upper,lower}case and non-alphanumeric characters is implicitly set to true commit f55f8517f8f8516192b5d156c71596e7fcc55ad2 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 23:11:06 2021 +0100 feat: table renames+call role-creating methods * no "AspNet" prefix * actually call Ensure{Admin,Roles}Created on app start commit 20d3458f281ec9478dc9b0fab3795556dcd0a78f Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 22:05:11 2021 +0100 fix typo: DbContext --> DBContext commit f972ac83e7197813bf4c9b4d9bb44d640b5dd071 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 20:55:22 2021 +0100 chore: add login and usr mgmt logic * add login and registration views * add methods to create admin user on app start commit b65a6d21f8dc5227a8da2d5040348e269c2f3711 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 16:02:33 2021 +0100 chore: add auth options * FIXME dev fun settings need to be replaced with proper settings commit 8f84939c22ec96e0a143350b9b9ba3d738dfc149 Author: surtur <a_mirre@utb.cz> Date: Wed Jan 27 14:54:57 2021 +0100 chore: adding identity roles (batch 1) * preparing Startup and DBContext to work with roles and auth * added Roles enum * added User model * added Microsoft.AspNetCore.Identity.EntityFrameworkCore v3.1.10 nuget * note: auth is not ready and working yet, this is batch one of the preparations
2021-01-28 15:27:25 +01:00
await DBInit.EnsureRolesCreated(serviceProvider);
await DBInit.EnsureAdminCreated(serviceProvider);
await DBInit.EnsureManagerCreated(serviceProvider);
}
webHost.Run();
2020-12-28 14:50:19 +01:00
}
2020-10-26 21:58:35 +01:00
2020-12-28 14:50:19 +01:00
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
2021-02-10 03:26:37 +01:00
.UseStartup<Startup>()
.ConfigureLogging((ctx, logging) => {
logging.ClearProviders();
logging.AddConsole();
logging.AddDebug();
logging.AddEventSourceLogger();
});
2020-12-28 14:50:19 +01:00
}
2020-10-26 21:58:35 +01:00
}