-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* OcelotBuilderExtensionsTests for Eureka SD * BuildServiceProvider(true) #2179 (comment) * Add TestHostBuilder with enabled scopes validation by default across all testing projects #2179 (comment) * Update Sample projects with force scopes validation. Add Ocelot.Samples.Web project. Add OcelotHostBuilder and DownstreamHostBuilder helpers. Add Ocelot.Samples.Web project reference to all samples projects. TargetFramework is `net8.0` only.
- Loading branch information
Showing
97 changed files
with
958 additions
and
871 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
samples/Administration/Ocelot.Samples.AdministrationApi.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>disable</ImplicitUsings> | ||
<Nullable>disable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Ocelot.Administration\Ocelot.Administration.csproj" /> | ||
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" /> | ||
<ProjectReference Include="..\Web\Ocelot.Samples.Web.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,39 @@ | ||
using Microsoft.AspNetCore; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Configuration; | ||
using Ocelot.DependencyInjection; | ||
using Ocelot.Middleware; | ||
using Ocelot.Provider.Eureka; | ||
using Ocelot.Provider.Polly; | ||
using Ocelot.Samples.Web; | ||
|
||
namespace ApiGateway | ||
namespace ApiGateway; | ||
|
||
public class Program | ||
{ | ||
public class Program | ||
public static void Main(string[] args) | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
BuildWebHost(args).Run(); | ||
} | ||
|
||
public static IWebHost BuildWebHost(string[] args) => | ||
WebHost.CreateDefaultBuilder(args) | ||
.UseUrls("http://localhost:5000") | ||
.ConfigureAppConfiguration((hostingContext, config) => | ||
{ | ||
config | ||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) | ||
.AddJsonFile("appsettings.json", true, true) | ||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) | ||
.AddJsonFile("ocelot.json", false, false) | ||
.AddEnvironmentVariables(); | ||
}) | ||
.ConfigureServices(s => | ||
{ | ||
s.AddOcelot() | ||
.AddEureka() | ||
.AddPolly(); | ||
}) | ||
.Configure(a => | ||
{ | ||
a.UseOcelot().Wait(); | ||
}) | ||
.Build(); | ||
OcelotHostBuilder.Create(args) | ||
.UseUrls("http://localhost:5000") | ||
.ConfigureAppConfiguration((hostingContext, config) => | ||
{ | ||
config | ||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) | ||
.AddJsonFile("appsettings.json", true, true) | ||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) | ||
.AddJsonFile("ocelot.json", false, false) | ||
.AddEnvironmentVariables(); | ||
}) | ||
.ConfigureServices(s => | ||
{ | ||
s.AddOcelot() | ||
.AddEureka() | ||
.AddPolly(); | ||
}) | ||
.Configure(a => | ||
{ | ||
a.UseOcelot().Wait(); | ||
}) | ||
.Build() | ||
.Run(); | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
samples/Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>disable</ImplicitUsings> | ||
<Nullable>disable</Nullable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Steeltoe.Discovery.Client" Version="1.1.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\Web\Ocelot.Samples.Web.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
using Microsoft.AspNetCore; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Ocelot.Samples.Web; | ||
using System; | ||
|
||
namespace DownstreamService | ||
namespace DownstreamService; | ||
|
||
public class Program | ||
{ | ||
public class Program | ||
public static void Main(string[] args) | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
BuildWebHost(args).Run(); | ||
} | ||
|
||
public static IWebHost BuildWebHost(string[] args) => | ||
WebHost.CreateDefaultBuilder(args) | ||
.UseUrls($"http://{Environment.MachineName}:5001") | ||
.UseStartup<Startup>() | ||
.Build(); | ||
DownstreamHostBuilder.Create(args) | ||
.UseUrls($"http://{Environment.MachineName}:5001") | ||
.UseStartup<Startup>() | ||
.Build() | ||
.Run(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.