umbau auf enviroment appsettings
All checks were successful
Restart Docker Container on Production / build (pull_request) Successful in 3m13s
All checks were successful
Restart Docker Container on Production / build (pull_request) Successful in 3m13s
This commit is contained in:
parent
eaadb96157
commit
aa03b6ae83
1
.github/workflows/deploy.test-env.yml
vendored
1
.github/workflows/deploy.test-env.yml
vendored
@ -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:
|
||||
|
||||
@ -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<App>()
|
||||
.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<IFeedDataService, FeedDataService>();
|
||||
builder.Services.AddSingleton<AppLifecycleService>();
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
builder.Logging.AddDebug();
|
||||
>>>>>>> css_bootstrap_blazor
|
||||
#endif
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<base href="/" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" />
|
||||
@* <link href="_content/RBLNews.Shared/blazor.bootstrap.css" rel="stylesheet" /> *@
|
||||
|
||||
@* <link rel="stylesheet" href="_content/RBLNews.Shared/css/bootstrap/bootstrap.min.css" /> *@
|
||||
@* <link rel="stylesheet" href="RBLNews.Web.styles.css" /> *@
|
||||
<link rel="stylesheet" href="_content/RBLNews.Shared/css/app.css" />
|
||||
<HeadOutlet @rendermode="InteractiveServer" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Routes @rendermode="InteractiveServer" />
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.0.1/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.2.0/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||
<!-- Add sortable.js reference if SortableList component is used in your application. -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
|
||||
>>>>>>> css_bootstrap_blazor
|
||||
<script src="_framework/blazor.web.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
6
RBLNews.Web/Models/AppSettingsModel.cs
Normal file
6
RBLNews.Web/Models/AppSettingsModel.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace RBLNews.Web.Models;
|
||||
|
||||
public class AppSettingsModel
|
||||
{
|
||||
public string BackendApiUrl { get; set; }
|
||||
}
|
||||
@ -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<IFeedDataService, FeedDataService>();
|
||||
builder.Services.AddSingleton<AppLifecycleService>();
|
||||
builder.Services.AddSingleton<EnvironmentVariablesService>();
|
||||
builder.Services.AddSingleton<ConfigService>();
|
||||
|
||||
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<ConfigService>();
|
||||
var a = configService.AppSettings;
|
||||
|
||||
EnvironmentVariablesService environmentVariablesService = services.GetRequiredService<EnvironmentVariablesService>();
|
||||
string? backendApiUrl = environmentVariablesService.RblApiUrl;
|
||||
|
||||
|
||||
@ -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<IFeedDataService, FeedDataService>();
|
||||
builder.Services.AddSingleton<AppLifecycleService>();
|
||||
>>>>>>> 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<App>()
|
||||
.AddInteractiveServerRenderMode()
|
||||
.AddAdditionalAssemblies(typeof(RBLNews.Shared._Imports).Assembly);
|
||||
|
||||
app.Run();
|
||||
@ -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,
|
||||
|
||||
18
RBLNews.Web/Services/ConfigService.cs
Normal file
18
RBLNews.Web/Services/ConfigService.cs
Normal file
@ -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<AppSettingsModel>();
|
||||
}
|
||||
}
|
||||
@ -4,5 +4,8 @@
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"App": {
|
||||
"BackendApiUrl": "https://rbl.wohlleben.dev"
|
||||
}
|
||||
}
|
||||
|
||||
12
RBLNews.Web/appsettings.Production.json
Normal file
12
RBLNews.Web/appsettings.Production.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"App": {
|
||||
"BackendApiUrl": "https://rblnews.de"
|
||||
}
|
||||
}
|
||||
@ -5,5 +5,8 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"App": {
|
||||
"BackendApiUrl": "https://rblnews.de"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user