diff --git a/.github/workflows/deploy.test-env.yml b/.github/workflows/deploy.test-env.yml index 9a3990d..d53d4b2 100644 --- a/.github/workflows/deploy.test-env.yml +++ b/.github/workflows/deploy.test-env.yml @@ -12,7 +12,6 @@ jobs: env: RUNNER_TOOL_CACHE: /toolcache IMAGE_NAME: rbl-news-webapp - DOCKER_CONTAINER_NAME: rbl-news-webapp REGISTRY: git.wohlleben.dev REPO_OWNER: itob steps: diff --git a/RBLNews.Maui/MauiProgram.cs.orig b/RBLNews.Maui/MauiProgram.cs.orig deleted file mode 100644 index 04667d8..0000000 --- a/RBLNews.Maui/MauiProgram.cs.orig +++ /dev/null @@ -1,44 +0,0 @@ -using CommunityToolkit.Maui; -using CommunityToolkit.Maui.Markup; -using Microsoft.Extensions.Logging; -using RBLNews.Shared.Services; - -namespace RBLNews.Maui -{ - public static class MauiProgram - { - public static MauiApp CreateMauiApp() - { - var builder = MauiApp.CreateBuilder(); - builder - .UseMauiApp() - .UseMauiCommunityToolkit() - .UseMauiCommunityToolkitMarkup() - .ConfigureFonts(fonts => - { - //fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); - fonts.AddFont("NanumMyeongjo-Regular.ttf", "NanumMyeongjoRegular"); - }); - - builder.Services.AddMauiBlazorWebView(); -<<<<<<< HEAD - -#if DEBUG - builder.Services.AddBlazorWebViewDeveloperTools(); - builder.Logging.AddDebug(); -======= - builder.Services.AddBlazorBootstrap(); - - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - -#if DEBUG - builder.Services.AddBlazorWebViewDeveloperTools(); - builder.Logging.AddDebug(); ->>>>>>> css_bootstrap_blazor -#endif - - return builder.Build(); - } - } -} diff --git a/RBLNews.Web/Components/App.razor.orig b/RBLNews.Web/Components/App.razor.orig deleted file mode 100644 index 76ed369..0000000 --- a/RBLNews.Web/Components/App.razor.orig +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - @* *@ - - @* *@ - @* *@ - - - - - - -<<<<<<< HEAD -======= - - - - - - - ->>>>>>> css_bootstrap_blazor - - - - diff --git a/RBLNews.Web/Models/AppSettingsModel.cs b/RBLNews.Web/Models/AppSettingsModel.cs new file mode 100644 index 0000000..53e9c38 --- /dev/null +++ b/RBLNews.Web/Models/AppSettingsModel.cs @@ -0,0 +1,6 @@ +namespace RBLNews.Web.Models; + +public class AppSettingsModel +{ + public string BackendApiUrl { get; set; } +} \ No newline at end of file diff --git a/RBLNews.Web/Program.cs b/RBLNews.Web/Program.cs index 91f494e..dfa915d 100644 --- a/RBLNews.Web/Program.cs +++ b/RBLNews.Web/Program.cs @@ -1,5 +1,6 @@ using RBLNews.Shared.Services; using RBLNews.Web.Components; +using RBLNews.Web.Services; var builder = WebApplication.CreateBuilder(args); @@ -11,6 +12,7 @@ builder.Services.AddBlazorBootstrap(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); var app = builder.Build(); @@ -26,6 +28,15 @@ if (!app.Environment.IsDevelopment()) using var serviceScope = app.Services.CreateScope(); IServiceProvider services = serviceScope.ServiceProvider; +var logger = LoggerFactory.Create(config => +{ + config.AddConsole(); +}).CreateLogger("Program"); + + +ConfigService configService = services.GetRequiredService(); +var a = configService.AppSettings; + EnvironmentVariablesService environmentVariablesService = services.GetRequiredService(); string? backendApiUrl = environmentVariablesService.RblApiUrl; diff --git a/RBLNews.Web/Program.cs.orig b/RBLNews.Web/Program.cs.orig deleted file mode 100644 index 761c4fa..0000000 --- a/RBLNews.Web/Program.cs.orig +++ /dev/null @@ -1,36 +0,0 @@ -using RBLNews.Shared.Services; -using RBLNews.Web.Components; - -var builder = WebApplication.CreateBuilder(args); - -// Add services to the container. -builder.Services.AddRazorComponents() - .AddInteractiveServerComponents(); -<<<<<<< HEAD -======= -builder.Services.AddBlazorBootstrap(); - -builder.Services.AddSingleton(); -builder.Services.AddSingleton(); ->>>>>>> css_bootstrap_blazor - -var app = builder.Build(); - -// Configure the HTTP request pipeline. -if (!app.Environment.IsDevelopment()) -{ - app.UseExceptionHandler("/Error", createScopeForErrors: true); - // 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.UseAntiforgery(); - -app.MapRazorComponents() - .AddInteractiveServerRenderMode() - .AddAdditionalAssemblies(typeof(RBLNews.Shared._Imports).Assembly); - -app.Run(); diff --git a/RBLNews.Web/Properties/launchSettings.json b/RBLNews.Web/Properties/launchSettings.json index d0779f2..b5991ff 100644 --- a/RBLNews.Web/Properties/launchSettings.json +++ b/RBLNews.Web/Properties/launchSettings.json @@ -18,7 +18,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "https": { + "https (DEV)": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, @@ -27,6 +27,15 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, + "https (PROD)": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7158;http://localhost:5289", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Production" + } + }, "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, diff --git a/RBLNews.Web/Services/ConfigService.cs b/RBLNews.Web/Services/ConfigService.cs new file mode 100644 index 0000000..3cf60fd --- /dev/null +++ b/RBLNews.Web/Services/ConfigService.cs @@ -0,0 +1,18 @@ +using RBLNews.Web.Models; + +namespace RBLNews.Web.Services; + +public class ConfigService +{ + private readonly IConfiguration _configuration; + + public AppSettingsModel AppSettings { get; private set; } + + public ConfigService(IConfiguration configuration) + { + this._configuration = configuration; + configuration.GetSection("App").Bind(this.AppSettings); + + AppSettings = configuration.GetSection("App").Get(); + } +} \ No newline at end of file diff --git a/RBLNews.Web/appsettings.Development.json b/RBLNews.Web/appsettings.Development.json index 0c208ae..af54d1e 100644 --- a/RBLNews.Web/appsettings.Development.json +++ b/RBLNews.Web/appsettings.Development.json @@ -4,5 +4,8 @@ "Default": "Information", "Microsoft.AspNetCore": "Warning" } + }, + "App": { + "BackendApiUrl": "https://rbl.wohlleben.dev" } } diff --git a/RBLNews.Web/appsettings.Production.json b/RBLNews.Web/appsettings.Production.json new file mode 100644 index 0000000..0c2c7dc --- /dev/null +++ b/RBLNews.Web/appsettings.Production.json @@ -0,0 +1,12 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "App": { + "BackendApiUrl": "https://rblnews.de" + } +} diff --git a/RBLNews.Web/appsettings.json b/RBLNews.Web/appsettings.json index 10f68b8..0c2c7dc 100644 --- a/RBLNews.Web/appsettings.json +++ b/RBLNews.Web/appsettings.json @@ -5,5 +5,8 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "App": { + "BackendApiUrl": "https://rblnews.de" + } }