Compare commits

...

4 Commits

Author SHA1 Message Date
Developer 02
27fb2af845 feat(controller): MetaController zum Abrufen der Parameter des Ursprungs-Servers hinzufügen 2025-01-29 17:50:19 +01:00
Developer 02
89b98af1be feat: Konfiguration für OriginServer-Parameter hinzufügen
- Die Klasse 'OriginServerParams' wurde hinzugefügt, um die URL und Header zu speichern.
- Konfigurationslogik implementiert, um den Abschnitt 'OriginServer' zu laden und sein Vorhandensein zu überprüfen.
2025-01-29 17:34:45 +01:00
Developer 02
c352ee987c refactor(Proxy): aktualisiert, um Proxy in der Produktion zu verwenden 2025-01-29 16:26:57 +01:00
Developer 02
590546c9f9 feat(Proxy): Initliazed .net api project. 2025-01-29 16:25:30 +01:00
8 changed files with 154 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34622.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.Swagger.Proxy", "src\DigitalData.Swagger.Proxy\DigitalData.Swagger.Proxy.csproj", "{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C5ED9B8C-5A36-440E-BF25-8FB0EC870924}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2CC25C4F-147E-4A64-9EA9-51C00BC7430E} = {C5ED9B8C-5A36-440E-BF25-8FB0EC870924}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {071BB599-BE8A-4680-A008-35B0357D4899}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,9 @@
namespace DigitalData.Swagger.Proxy.Configs
{
public class OriginServerParams
{
public required string Url { get; init; }
public Dictionary<string, string>? Headers { get; init; }
}
}

View File

@@ -0,0 +1,13 @@
using DigitalData.Swagger.Proxy.Configs;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
namespace DigitalData.Swagger.Proxy.Controllers;
[Route("[controller]")]
[ApiController]
public class MetaController(IOptions<OriginServerParams> originServerParamsoptions) : ControllerBase
{
[HttpGet]
public IActionResult GetOriginServerParams() => Ok(originServerParamsoptions.Value);
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,31 @@
using DigitalData.Swagger.Proxy.Configs;
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var originServerSection = config.GetRequiredSection("OriginServer")
?? throw new InvalidOperationException("The 'OriginServer' section is missing or incorrectly configured in the application configuration.");
builder.Services.Configure<OriginServerParams>(originServerSection);
var app = builder.Build();
// use swagger in production
app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:60947",
"sslPort": 44357
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5082",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7121;http://localhost:5082",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}