fix gateway本地配置

This commit is contained in:
2024-03-26 19:01:31 +08:00
parent b3549a266e
commit 97ccd72338
4 changed files with 104 additions and 2 deletions

View File

@@ -14,4 +14,12 @@
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.8" />
</ItemGroup>
<ItemGroup>
<Content Update="ocelot.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -6,9 +6,10 @@ public class Program
public static void Main(string[] args)
{
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration(builder =>
.ConfigureAppConfiguration((context, builder) =>
{
builder.AddJsonFile("ocelot.json", true, true);
builder.AddJsonFile($"ocelot.{context.HostingEnvironment.EnvironmentName}.json", true, true);
})
.ConfigureWebHostDefaults(webBuilder =>
{

View File

@@ -7,7 +7,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5001"
"applicationUrl": "http://*:6000"
}
},
"$schema": "https://json.schemastore.org/launchsettings.json"

View File

@@ -0,0 +1,93 @@
{
"Routes": [
{
"UpstreamPathTemplate": "/api/oauth2/{url}",
"DownstreamPathTemplate": "/api/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5000
}
]
},
{
"UpstreamPathTemplate": "/api/common/{url}",
"DownstreamPathTemplate": "/api/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5001
}
]
},
{
"UpstreamPathTemplate": "/api/sys/{url}",
"DownstreamPathTemplate": "/api/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5003
}
]
},
{
"UpstreamPathTemplate": "/api/user/{url}",
"DownstreamPathTemplate": "/api/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5004
}
]
},
{
"UpstreamPathTemplate": "/api/basic/{url}",
"DownstreamPathTemplate": "/api/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5002
}
]
},
{
"UpstreamPathTemplate": "/api/scheduled/{url}",
"DownstreamPathTemplate": "/api/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5010
}
]
},
{
"UpstreamPathTemplate": "/api/canteen/{url}",
"DownstreamPathTemplate": "/api/{url}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5008
}
]
},
{
"UpstreamPathTemplate": "/{url}/swagger/v1/swagger.json",
"DownstreamPathTemplate": "/{url}/swagger/v1/swagger.json",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 6000
}
]
}
],
"GlobalConfiguration": {}
}