Compare commits
25 Commits
eceaf066d7
...
feat/envel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
941e47ba3e | ||
|
|
a76afdda34 | ||
|
|
0d0e4675ad | ||
|
|
6ade388cd7 | ||
|
|
5f21002e4f | ||
|
|
6be3d5373a | ||
|
|
d34ba75deb | ||
|
|
dccaaf2feb | ||
|
|
1957626ef2 | ||
|
|
7069938d34 | ||
|
|
23e73aae19 | ||
|
|
23d73e0671 | ||
|
|
84a25752b5 | ||
|
|
72b1c58b72 | ||
|
|
4173c3d96a | ||
|
|
693a835191 | ||
|
|
8a8f77c4d5 | ||
|
|
08e3cdddb0 | ||
|
|
e1bd477753 | ||
|
|
174338af5d | ||
|
|
e3be4f5e6f | ||
|
|
cbd3accf72 | ||
|
|
d108978b63 | ||
|
|
6a536e950d | ||
|
|
0efb035d12 |
13
.config/dotnet-tools.json
Normal file
13
.config/dotnet-tools.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "9.0.3",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.0.0</Version>
|
||||
<AssemblyVersion>1.0.0</AssemblyVersion>
|
||||
<FileVersion>1.0.0</FileVersion>
|
||||
<Version>1.2.0</Version>
|
||||
<AssemblyVersion>1.2.0</AssemblyVersion>
|
||||
<FileVersion>1.2.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ocelot" Version="22.0.1" />
|
||||
<PackageReference Include="NLog" Version="5.4.0" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.4.0" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.4.0" />
|
||||
<PackageReference Include="Ocelot" Version="23.4.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
58
Program.cs
58
Program.cs
@@ -1,26 +1,46 @@
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||
logger.Info("Logging initialized.");
|
||||
|
||||
// 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 =>
|
||||
try
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
app.UseOcelot().Wait();
|
||||
builder.Logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
|
||||
|
||||
app.Run();
|
||||
if (!builder.Environment.IsDevelopment())
|
||||
{
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Host.UseNLog();
|
||||
}
|
||||
|
||||
// Make sure to add the Ocelot configuration file
|
||||
var suffix = builder.Environment.IsDevelopment() ? ".Development" : "";
|
||||
builder.Configuration.AddJsonFile($"ocelot{suffix}.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.MapControllers();
|
||||
|
||||
app.UseOcelot().Wait();
|
||||
|
||||
app.Run();
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
logger.Error(ex, "Stopped program because of exception.");
|
||||
throw;
|
||||
}
|
||||
22
Properties/PublishProfiles/IISProfileNet9Win64.pubxml
Normal file
22
Properties/PublishProfiles/IISProfileNet9Win64.pubxml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<WebPublishMethod>Package</WebPublishMethod>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<ProjectGuid>329f45bf-4c79-4a7b-9086-d6205617aa42</ProjectGuid>
|
||||
<DesktopBuildPackageLocation>P:\Install .Net\0 DD - Smart UP\Gateway\EnvelopeGeneratorGen\Net9Win64\$(Version)\$(Version).zip</DesktopBuildPackageLocation>
|
||||
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||
<DeployIisAppPath>Gateway</DeployIisAppPath>
|
||||
<_TargetId>IISWebDeployPackage</_TargetId>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>false</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -23,7 +23,7 @@
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"launchUrl": "swagger/index.html",
|
||||
"applicationUrl": "https://localhost:7052;http://localhost:5028",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
|
||||
@@ -5,5 +5,48 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"NLog": {
|
||||
"throwConfigExceptions": true,
|
||||
"variables": {
|
||||
"logDirectory": "E:\\LogFiles\\Digital Data\\workFlow.Gateway",
|
||||
"logFileNamePrefix": "${shortdate}-workFlow.Gateway"
|
||||
},
|
||||
"targets": {
|
||||
"infoLogs": {
|
||||
"type": "File",
|
||||
"fileName": "${logDirectory}\\${logFileNamePrefix}-Info.log",
|
||||
"maxArchiveDays": 30
|
||||
},
|
||||
"errorLogs": {
|
||||
"type": "File",
|
||||
"fileName": "${logDirectory}\\${logFileNamePrefix}-Error.log",
|
||||
"maxArchiveDays": 30
|
||||
},
|
||||
"criticalLogs": {
|
||||
"type": "File",
|
||||
"fileName": "${logDirectory}\\${logFileNamePrefix}-Critical.log",
|
||||
"maxArchiveDays": 30
|
||||
}
|
||||
},
|
||||
// Trace, Debug, Info, Warn, Error and *Fatal*
|
||||
"rules": [
|
||||
{
|
||||
"logger": "*",
|
||||
"minLevel": "Info",
|
||||
"maxLevel": "Warn",
|
||||
"writeTo": "infoLogs"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"level": "Error",
|
||||
"writeTo": "errorLogs"
|
||||
},
|
||||
{
|
||||
"logger": "*",
|
||||
"level": "Fatal",
|
||||
"writeTo": "criticalLogs"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
159
ocelot.Development.json
Normal file
159
ocelot.Development.json
Normal file
@@ -0,0 +1,159 @@
|
||||
{
|
||||
"Routes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/swagger/{route}",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/swagger/{route}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/swagger/{route1}/{route2}",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/swagger/{route1}/{route2}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/scalar",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/scalar",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/scalar/{route}",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/scalar/{route}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/scalar/{route1}/{route2}",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/scalar/{route1}/{route2}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/Auth/sign-flow-gen?cookie={cookie}",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 7192
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/Auth?cookie={cookie}",
|
||||
"UpstreamHttpMethod": [ "Post" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/Auth/sign-flow-gen?cookie=false",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 7192
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/Auth",
|
||||
"UpstreamHttpMethod": [ "Post" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/Auth/sign-flow-gen/login",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 7192
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/Auth/form",
|
||||
"UpstreamHttpMethod": [ "Post" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{route}",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{route}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{route}/{id}",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{route}{id}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Delete"
|
||||
]
|
||||
}
|
||||
],
|
||||
"GlobalConfiguration": {
|
||||
}
|
||||
}
|
||||
140
ocelot.json
140
ocelot.json
@@ -1,19 +1,147 @@
|
||||
{
|
||||
"Routes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/swagger/index.html",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamPathTemplate": "/swagger/{route}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 7192
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/auth-swagger",
|
||||
"UpstreamHttpMethod": [ "Get" ]
|
||||
"UpstreamPathTemplate": "/swagger/{route}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/swagger/{route1}/{route2}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/swagger/{route1}/{route2}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/scalar",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/scalar",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/scalar/{route}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/scalar/{route}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/scalar/{route1}/{route2}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/scalar/{route1}/{route2}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/Auth/work-flow?cookie=false",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/Auth",
|
||||
"UpstreamHttpMethod": [ "Post" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/Auth/check",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/Auth/check",
|
||||
"UpstreamHttpMethod": [ "Post" ]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{route}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{route}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Post",
|
||||
"Put",
|
||||
"Delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/{route}/{id}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 8088
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/api/{route}{id}",
|
||||
"UpstreamHttpMethod": [
|
||||
"Get",
|
||||
"Delete"
|
||||
]
|
||||
}
|
||||
],
|
||||
"GlobalConfiguration": {
|
||||
"BaseUrl": "https://localhost:7052"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user