umbau auf enviroment appsettings
All checks were successful
Restart Docker Container on Production / build (pull_request) Successful in 3m0s
All checks were successful
Restart Docker Container on Production / build (pull_request) Successful in 3m0s
This commit is contained in:
parent
2b74f17012
commit
f185b54902
@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Maui;
|
||||
using System.Reflection;
|
||||
using CommunityToolkit.Maui;
|
||||
using CommunityToolkit.Maui.Markup;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@ -40,9 +41,16 @@ namespace RBLNews.Maui
|
||||
builder.Logging.AddDebug();
|
||||
#endif
|
||||
|
||||
Stream? appSettingFile = Assembly.GetExecutingAssembly().GetManifestResourceStream($"appsettings.json");
|
||||
if (appSettingFile != null)
|
||||
{
|
||||
IConfiguration configuration = new ConfigurationManager().AddJsonStream(appSettingFile).Build();
|
||||
builder.Configuration.AddConfiguration(configuration);
|
||||
}
|
||||
|
||||
MauiApp app = builder.Build();
|
||||
|
||||
AppSettingsModel? appSettings = app.Configuration.GetSection("Logging").Get<AppSettingsModel>();
|
||||
AppSettingsModel? appSettings = app.Configuration.GetSection("App").Get<AppSettingsModel>();
|
||||
|
||||
if (string.IsNullOrEmpty(appSettings?.BackendApiUrl))
|
||||
{
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
"profiles": {
|
||||
"Windows Machine": {
|
||||
"commandName": "MsixPackage",
|
||||
"nativeDebugging": false
|
||||
"nativeDebugging": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -80,16 +80,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="appsettings.Development.json">
|
||||
<EmbeddedResource Include="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="appsettings.json">
|
||||
<EmbeddedResource Include="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="appsettings.Production.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="appsettings.Test.json">
|
||||
<EmbeddedResource Include="appsettings.Production.json" />
|
||||
<EmbeddedResource Include="appsettings.Test.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
@ -98,6 +96,8 @@
|
||||
<PackageReference Include="Blazor.Bootstrap" Version="3.0.0" />
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.3" />
|
||||
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="4.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.90" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.90" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="8.0.90" />
|
||||
|
||||
@ -7,6 +7,28 @@
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="appsettings.Development.json" />
|
||||
<Content Remove="appsettings.json" />
|
||||
<Content Remove="appsettings.Production.json" />
|
||||
<Content Remove="appsettings.Test.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="appsettings.Production.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="appsettings.Test.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RBLNews.Shared\RBLNews.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
@ -19,18 +41,6 @@
|
||||
<Content Update="wwwroot\fonts\NanumMyeongjo-Regular.ttf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Development.json">
|
||||
<Link>appsettings.Development.json</Link>
|
||||
</Content>
|
||||
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.json">
|
||||
<Link>appsettings.json</Link>
|
||||
</Content>
|
||||
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Production.json">
|
||||
<Link>appsettings.Production.json</Link>
|
||||
</Content>
|
||||
<Content Include="..\RBLNews.Shared\wwwroot\appsettings.Test.json">
|
||||
<Link>appsettings.Test.json</Link>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
11
RBLNews.Web/appsettings.Development.json
Normal file
11
RBLNews.Web/appsettings.Development.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"App": {
|
||||
"BackendApiUrl": "https://localhost:5147"
|
||||
}
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
12
RBLNews.Web/appsettings.Test.json
Normal file
12
RBLNews.Web/appsettings.Test.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"App": {
|
||||
"BackendApiUrl": "https://rbl.wohlleben.dev"
|
||||
}
|
||||
}
|
||||
9
RBLNews.Web/appsettings.json
Normal file
9
RBLNews.Web/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user