+ Rutas HC, + Logs

This commit is contained in:
Luis M 2024-02-09 17:57:46 -05:00
parent 7e4cbf914e
commit 45172879b1
3 changed files with 59 additions and 5 deletions

View File

@ -24,8 +24,8 @@ namespace ApiGateway
//var route2 = ctx.Items.DownstreamRequest(); //Solo el path del request //var route2 = ctx.Items.DownstreamRequest(); //Solo el path del request
//var route3 = ctx.Items.DownstreamRoute(); //Datos full del request //var route3 = ctx.Items.DownstreamRoute(); //Datos full del request
//var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog()); var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog());
//var logger = loggerFactory.CreateLogger("Auth"); var logger = loggerFactory.CreateLogger("Auth");
//TODO: ELIMINAR ESTAS RUTAS POR COMPLETO! //TODO: ELIMINAR ESTAS RUTAS POR COMPLETO!
// TknCambioClave // TknCambioClave
@ -165,7 +165,7 @@ namespace ApiGateway
} }
catch (Exception e) catch (Exception e)
{ {
//logger.LogError(71, e.Message); logger.LogError(71, e.Message);
ctx.Items.SetError(new UnauthenticatedError(e.Message)); ctx.Items.SetError(new UnauthenticatedError(e.Message));
return false; return false;
} }

View File

@ -20,7 +20,7 @@ builder.Configuration.AddOcelotWithSwaggerSupport(options =>
var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog()); var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog());
//var logger = loggerFactory.CreateLogger("Gateway"); var logger = loggerFactory.CreateLogger("Gateway");
builder.Configuration.SetBasePath(builder.Environment.ContentRootPath) builder.Configuration.SetBasePath(builder.Environment.ContentRootPath)
.AddJsonFile("ocelot.json", optional: false, reloadOnChange: true) .AddJsonFile("ocelot.json", optional: false, reloadOnChange: true)
@ -61,7 +61,7 @@ var pipeConfig = new OcelotPipelineConfiguration
.Append("Date: ").AppendLine(date) .Append("Date: ").AppendLine(date)
.Append("Errors: ") .Append("Errors: ")
.AppendLine(downStreamContext.Items.Errors().ToString()); .AppendLine(downStreamContext.Items.Errors().ToString());
//logger.LogWarning(27, sb2.ToString()); logger.LogWarning(27, sb2.ToString());
//downStreamContext.Items.SetError(new UnauthenticatedError("Nel wey, no estas autorizado")); //downStreamContext.Items.SetError(new UnauthenticatedError("Nel wey, no estas autorizado"));
return; return;
} }

View File

@ -504,6 +504,60 @@
"POST" "POST"
] ]
}, },
{
"SwaggerKey": "MsHistoriaClinica",
"UpstreamPathTemplate": "/Incapacidades/Masivo",
"DownstreamPathTemplate": "/Incapacidades/Masivo",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8154
}
],
"RouteClaimsRequirement": {
"permisos": "any"
},
"UpstreamHttpMethod": [
"POST"
]
},
{
"SwaggerKey": "MsHistoriaClinica",
"UpstreamPathTemplate": "/PagosLicencias",
"DownstreamPathTemplate": "/PagosLicencias",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8154
}
],
"RouteClaimsRequirement": {
"permisos": "any"
},
"UpstreamHttpMethod": [
"GET"
]
},
{
"SwaggerKey": "MsHistoriaClinica",
"UpstreamPathTemplate": "/PagosLicencias/Masivo",
"DownstreamPathTemplate": "/PagosLicencias/Masivo",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8154
}
],
"RouteClaimsRequirement": {
"permisos": "any"
},
"UpstreamHttpMethod": [
"POST"
]
},
{ {
"SwaggerKey": "MsHistoriaClinica", "SwaggerKey": "MsHistoriaClinica",
"UpstreamPathTemplate": "/Rias", "UpstreamPathTemplate": "/Rias",