chore: ocelot installiert und für den Beispieldienst konfiguriert

This commit is contained in:
Developer 02 2025-01-15 14:36:38 +01:00
parent 9def5216be
commit eceaf066d7
7 changed files with 144 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ocelot" Version="22.0.1" />
</ItemGroup>
</Project>

25
DigitalData.Gateway.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.Gateway", "DigitalData.Gateway.csproj", "{329F45BF-4C79-4A7B-9086-D6205617AA42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{329F45BF-4C79-4A7B-9086-D6205617AA42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{329F45BF-4C79-4A7B-9086-D6205617AA42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{329F45BF-4C79-4A7B-9086-D6205617AA42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{329F45BF-4C79-4A7B-9086-D6205617AA42}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {54236E11-D1EF-4FEE-A572-EB19134EE991}
EndGlobalSection
EndGlobal

26
Program.cs Normal file
View File

@ -0,0 +1,26 @@
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
var builder = WebApplication.CreateBuilder(args);
// Make sure to add the Ocelot configuration file
builder.Configuration.AddJsonFile("ocelot.json");
// Add Ocelot services
builder.Services.AddOcelot();
var app = builder.Build();
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
// Use Ocelot middleware in an appropriate way
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseOcelot().Wait();
app.Run();

View File

@ -0,0 +1,41 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:19172",
"sslPort": 44316
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "usermanagerservice",
"applicationUrl": "http://localhost:5028",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7052;http://localhost:5028",
"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"
}
}
}

9
appsettings.json Normal file
View File

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

19
ocelot.json Normal file
View File

@ -0,0 +1,19 @@
{
"Routes": [
{
"DownstreamPathTemplate": "/swagger/index.html",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7192
}
],
"UpstreamPathTemplate": "/auth-swagger",
"UpstreamHttpMethod": [ "Get" ]
}
],
"GlobalConfiguration": {
"BaseUrl": "https://localhost:7052"
}
}