diff --git a/Src/Gateway/Gateway.csproj b/Src/Gateway/Gateway.csproj index 4dc2203d..b68b6edf 100644 --- a/Src/Gateway/Gateway.csproj +++ b/Src/Gateway/Gateway.csproj @@ -14,4 +14,12 @@ + + + PreserveNewest + true + PreserveNewest + + + diff --git a/Src/Gateway/Program.cs b/Src/Gateway/Program.cs index 5e1e7a63..e96a2582 100644 --- a/Src/Gateway/Program.cs +++ b/Src/Gateway/Program.cs @@ -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 => { diff --git a/Src/Gateway/Properties/launchSettings.json b/Src/Gateway/Properties/launchSettings.json index 4384f481..34ddc54f 100644 --- a/Src/Gateway/Properties/launchSettings.json +++ b/Src/Gateway/Properties/launchSettings.json @@ -7,7 +7,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "dotnetRunMessages": true, - "applicationUrl": "http://localhost:5001" + "applicationUrl": "http://*:6000" } }, "$schema": "https://json.schemastore.org/launchsettings.json" diff --git a/Src/Gateway/ocelot.Development.json b/Src/Gateway/ocelot.Development.json new file mode 100644 index 00000000..7e569f4e --- /dev/null +++ b/Src/Gateway/ocelot.Development.json @@ -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": {} +} \ No newline at end of file