feat: 完善网关容器化与限流监控

This commit is contained in:
2025-12-03 14:49:33 +08:00
parent 5361451140
commit 6b5da04751
8 changed files with 332 additions and 37 deletions

View File

@@ -0,0 +1,75 @@
{
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning",
"Yarp": "Information"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
}
}
],
"Enrich": [ "FromLogContext" ],
"Properties": {
"Application": "TakeoutSaaS.ApiGateway"
}
},
"Gateway": {
"RateLimiting": {
"Enabled": true,
"PermitLimit": 300,
"WindowSeconds": 60,
"QueueLimit": 100
}
},
"OpenTelemetry": {
"Enabled": true,
"ServiceName": "TakeoutSaaS.ApiGateway",
"OtlpEndpoint": "http://localhost:4317"
},
"ReverseProxy": {
"Routes": [
{
"RouteId": "admin-route",
"ClusterId": "admin",
"Match": { "Path": "/api/admin/{**catch-all}" }
},
{
"RouteId": "mini-route",
"ClusterId": "mini",
"Match": { "Path": "/api/mini/{**catch-all}" }
},
{
"RouteId": "user-route",
"ClusterId": "user",
"Match": { "Path": "/api/user/{**catch-all}" }
}
],
"Clusters": {
"admin": {
"Destinations": {
"primary": { "Address": "http://49.7.179.246:7801/" }
}
},
"mini": {
"Destinations": {
"primary": { "Address": "http://49.7.179.246:7701/" }
}
},
"user": {
"Destinations": {
"primary": { "Address": "http://49.7.179.246:7901/" }
}
}
}
},
"AllowedHosts": "*"
}