gpt4 book ai didi

ocelot - 无法合并 Ocelot 配置文件

转载 作者:行者123 更新时间:2023-12-03 14:31:12 31 4
gpt4 key购买 nike

根据 documentation我尝试合并我的配置文件,以便它们更具可读性。然而,生成的 ocelot.json 文件并不像预期的那样。我的文件夹结构如下:
Folder structure
下面是这个的文本表示:

.
└── Ocelot route configs
├── ocelot.pokemon.json
├── ocelot.tweet.json
└── ocelot.weather.json
ocelot.pokemon.json 文件如下所示(其他类似):
{
"Routes": [
{
"DownstreamPathTemplate": "/api/v2/pokemon",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "pokeapi.co",
"Port": 443
}
],
"UpstreamPathTemplate": "/api/pokemon",
"UpstreamHttpMethod": [ "GET" ],
"AuthenticationOptions": {
"AuthenticationProviderKey": "MyTestKey",
"AllowedScopes": []
}
},
{
"DownstreamPathTemplate": "/api/v2/pokemon/ditto",
"DownstreamScheme": "https",
"DownstreamHostAndPorts": [
{
"Host": "pokeapi.co",
"Port": 443
}
],
"UpstreamPathTemplate": "/api/pokemon/ditto",
"UpstreamHttpMethod": [ "GET" ]
}
]
}
生成的 ocelot.json 文件如下所示:
{
"Routes": [
],
"DynamicRoutes": [
],
"Aggregates": [
],
"GlobalConfiguration": {
"RequestIdKey": null,
"ServiceDiscoveryProvider": {
"Scheme": null,
"Host": null,
"Port": 0,
"Type": null,
"Token": null,
"ConfigurationKey": null,
"PollingInterval": 0,
"Namespace": null
},
"RateLimitOptions": {
"ClientIdHeader": "ClientId",
"QuotaExceededMessage": null,
"RateLimitCounterPrefix": "ocelot",
"DisableRateLimitHeaders": false,
"HttpStatusCode": 429
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 0,
"DurationOfBreak": 0,
"TimeoutValue": 0
},
"BaseUrl": null,
"LoadBalancerOptions": {
"Type": null,
"Key": null,
"Expiry": 0
},
"DownstreamScheme": null,
"HttpHandlerOptions": {
"AllowAutoRedirect": false,
"UseCookieContainer": false,
"UseTracing": false,
"UseProxy": true,
"MaxConnectionsPerServer": 2147483647
},
"DownstreamHttpVersion": null
}
}
如您所见,我定义的路由没有添加。我尝试在互联网上查找此特定问题,但找不到任何内容。我不知道我做错了什么,将不胜感激。

最佳答案

由于您的不同路由配置文件位于一个文件夹中,您应该确保调用 AddOcelot 方法的正确重载。在这种情况下,应使用包含路由文件的文件夹名称调用该方法。
例如:

config.AddOcelot("Ocelot route configs", hostingContext.HostingEnvironment)

关于ocelot - 无法合并 Ocelot 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67057050/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com