根据文档,我尝试合并我的配置文件,以便它们更具可读性。然而,生成的 ocelot.json 文件并不像预期的那样。我的文件夹结构如下:
下面是这个的文本表示:
.
??? Ocelot route configs
??? ocelot.pokemon.json
??? ocelot.tweet.json
??? ocelot.weather.json
Run Code Online (Sandbox Code Playgroud)
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" ]
}
]
}
Run Code Online (Sandbox Code Playgroud)
生成的 ocelot.json 文件如下所示:
{
"Routes": [ …
Run Code Online (Sandbox Code Playgroud) ocelot ×1