Skip to content

Commit a90664b

Browse files
raman-mTomPallisterjusso-devJustin Middler
authored
Release features #1499 #1663 (#1660) (#1693)
* push code coverage for main and develop branches * #1660 Huge logs because of StyleCop.Analyzers warnings (#1663) * Add StyleCop.Analyzers package * Fix SA0001: XML comment analysis is disabled due to project configuration * Fix SA1609: Property documentation should have value * Fix CS1591: Missing XML comment for publicly visible type or member {xyz} * Fix SA1101: Prefix local calls with this * Fix SA1413: The last statement in a multi-line C# initializer or list is missing a trailing comma. * Fix SA1135: A using directive is not qualified. * Fix compiler errors * Fix SA1651: Do not use placeholder elements * Fix compiling error * Fix SA1113: Comma should be on the same line as previous parameter * Fix SA1116: The parameters should begin on the line after the declaration, whenever the parameter span across multiple lines * Fix SA1137: Elements should have the same indentation * Fix SA1200: Using directive should appear within a namespace declaration * Fix SA1316: Tuple element names should use correct casing * Fix SA1503: Braces should not be omitted * Fix SA1505: An opening brace should not be followed by a blank line * Fix SA1507: Code should not contain multiple blank lines in a row * Fix SA1508: A closing brace should not be preceded by a blank line * Fix SA1512, SA1515 * Fix SA1513: Closing brace should be followed by blank line * Fix SA1400: Element 'OpenTracingTracer' should declare an access modifier * Fix SA1515: Single-line comment should be preceded by blank line * Fix SA1518: File is required to end with a single newline character * Add StyleCop * Fix SA1633: A C# code file is missing a standard file header. * Disable SA1602: An item within a C# enumeration is missing an Xml documentation header. * Fix SA1600: Elements should be documented * Fix SA1604: Element documentation should have summary * Fix SA1618: The documentation for type parameter 'T' is missing * Fix SA1629: Documentation text should end with a period. * Fix SA1649: File name should match first type name * Fix SA1600: Elements should be documented * Upgrade K8s sample to ASP.NET 7. Rename project to Ocelot.Samples.OcelotKube.DownstreamService * Upgrade K8s sample to ASP.NET 7. Rename project to Ocelot.Samples.OcelotKube.ApiGateway * Fix CS0169: The field 'xxx' is never used * Fix CS0219: The variable 'baseUrl' is assigned but its value is never used * Fix CS0414: The field 'xxx' is assigned but its value is never used * Fix CS1570: XML comment has badly formed XML * Fix CS0649: Field 'xxx' is never assigned to, and will always have its default value null * Fix CS0618: 'member' is obsolete: 'text' * Fix NU1504: Duplicate 'PackageReference' items found: Microsoft.Data.SQLite 7.0.4, Microsoft.Data.SQLite 7.0.5 * Upgrade sample to ASP.NET 7 * Fix NU5048: The 'PackageIconUrl'/'iconUrl' element is deprecated. Consider using the 'PackageIcon'/'icon' element instead. Learn more at https://aka.ms/deprecateIconUrl * Rewrite a RequestDelegate object definition * Fix CS0618: 'member' is obsolete: 'text' * Fix CA1816: Change Dispose() to call GC.SuppressFinalize(object). This will prevent derived types that introduce a finalizer from needing to re-implement 'IDisposable' to call it. * Fix CA1822: Member 'GivenThereIsAConfiguration' does not access instance data and can be marked as static * Fix CA1837: Use 'Environment.ProcessId' instead of 'Process.GetCurrentProcess().Id' * Fix CA2211: Non-constant fields should not be visible. Convert to property. * Fix IDE0060: Remove unused parameter 'path' if it is not part of a shipped public API * Fix CA1816: Change ConsulWebSocketTests.Dispose() to call GC.SuppressFinalize(object). * Fix IDE1006: Naming rule violation: These words must begin with upper case characters * Fix IDE1006: Naming rule violation: These words must begin with upper case characters: AcceptanceTests\WebSocketTests * Fix last issues * Upgrade basic sample to ASP.NET 7 * fixed up required spacing in README (#1499) Co-authored-by: Justin Middler <[email protected]> * Update README.md --------- Co-authored-by: TomPallister <[email protected]> Co-authored-by: Justin Middler <[email protected]> Co-authored-by: Justin Middler <[email protected]> Co-authored-by: Tom Pallister <[email protected]>
1 parent fdc761c commit a90664b

File tree

446 files changed

+5460
-5453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

446 files changed

+5460
-5453
lines changed

Ocelot.sln

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Kubernetes"
5050
EndProject
5151
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}"
5252
EndProject
53-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotBasic", "samples\OcelotBasic\OcelotBasic.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
53+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotBasic.ApiGateway", "samples\OcelotBasic\Ocelot.Samples.OcelotBasic.ApiGateway.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
5454
EndProject
5555
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdministrationApi", "samples\AdministrationApi\AdministrationApi.csproj", "{B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}"
5656
EndProject
@@ -64,9 +64,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "sample
6464
EndProject
6565
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k8s", "k8s", "{4B706988-4817-43A8-ABE1-32A67998C2C8}"
6666
EndProject
67-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiGateway", "samples\OcelotKube\ApiGateway\ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
67+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.ApiGateway", "samples\OcelotKube\ApiGateway\Ocelot.Samples.OcelotKube.ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
6868
EndProject
69-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "samples\OcelotKube\DownstreamService\DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
69+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.DownstreamService", "samples\OcelotKube\DownstreamService\Ocelot.Samples.OcelotKube.DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
7070
EndProject
7171
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service-fabric", "service-fabric", "{B412628F-C325-47E1-A8D9-873DE04C8AF5}"
7272
EndProject

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ that need a unified point of entry into their system. However it will work with
1111

1212
In particular I want easy integration with IdentityServer reference and bearer tokens.
1313

14-
We have been unable to find this in my current workplacewithout having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already existsto do this.
14+
We have been unable to find this in my current workplace without having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already exists to do this.
1515

1616
Ocelot is a bunch of middlewares in a specific order.
1717

@@ -70,13 +70,3 @@ Pull requests, issues and commentary welcome!
7070
Please complete the relevant template for issues and PRs. Sometimes it's worth getting in touch with us to discuss changes before doing any work incase this is something we are already doing or it might not make sense. We can also give advice on the easiest way to do things :)
7171

7272
Finally we mark all existing issues as help wanted, small, medium and large effort. If you want to contribute for the first time I suggest looking at a help wanted & small effort issue :)
73-
74-
## Donate
75-
76-
If you think this project is worth supporting financially please make a contribution using the button below! We use the money to run the https://threemammals.com website.
77-
78-
[![Support via PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://www.paypal.me/ThreeMammals/)
79-
80-
## Things that are currently annoying me
81-
82-
[![](https://codescene.io/projects/697/status.svg) Get more details at **codescene.io**.](https://codescene.io/projects/697/jobs/latest-successful/results)

build.cake

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Task("RunUnitTests")
195195

196196
GenerateReport(coverageSummaryFile);
197197

198-
if (IsRunningOnCircleCI() && IsMain())
198+
if (IsRunningOnCircleCI() && IsMainOrDevelop())
199199
{
200200
var repoToken = EnvironmentVariable(coverallsRepoToken);
201201
if (string.IsNullOrEmpty(repoToken))
@@ -555,7 +555,19 @@ private bool IsRunningOnCircleCI()
555555
return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CIRCLECI"));
556556
}
557557

558-
private bool IsMain()
558+
private bool IsMainOrDevelop()
559559
{
560-
return Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower() == "main";
560+
var env = Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower();
561+
562+
if(env == "main")
563+
{
564+
return true;
565+
}
566+
567+
if(env == "develop")
568+
{
569+
return true;
570+
}
571+
572+
return false;
561573
}

codeanalysis.ruleset

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RuleSet Name="Rules for StyleCop.Analyzers" Description="Code analysis rules for StyleCop.Analyzers.csproj." ToolsVersion="15.0">
2+
<RuleSet Name="Rules for StyleCop.Analyzers" Description="Code analysis rules for StyleCop.Analyzers.csproj." ToolsVersion="17.0">
33
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
44
<Rule Id="AvoidAsyncSuffix" Action="None" />
55
<Rule Id="AvoidAsyncVoid" Action="Error" />
@@ -50,12 +50,11 @@
5050
<Rule Id="SA1209" Action="None" />
5151
<Rule Id="SA1210" Action="None" />
5252
<Rule Id="SA1214" Action="None" />
53-
<Rule Id="SA1216" Action="None" />
53+
<Rule Id="SA1216" Action="None" />
5454
<Rule Id="SA1300" Action="None" />
5555
<Rule Id="SA1302" Action="Error" />
5656
<Rule Id="SA1303" Action="None" />
5757
<Rule Id="SA1304" Action="Error" />
58-
<Rule Id="SA1305" Action="None" />
5958
<Rule Id="SA1309" Action="None" />
6059
<Rule Id="SA1310" Action="None" />
6160
<Rule Id="SA1311" Action="Error" />
@@ -70,14 +69,14 @@
7069
<Rule Id="SA1408" Action="None" />
7170
<Rule Id="SA1410" Action="Error" />
7271
<Rule Id="SA1411" Action="Error" />
73-
<Rule Id="SA1412" Action="None" />
7472
<Rule Id="SA1500" Action="None" />
7573
<Rule Id="SA1502" Action="None" />
7674
<Rule Id="SA1516" Action="None" />
7775
<Rule Id="SA1600" Action="None" />
76+
<Rule Id="SA1602" Action="None" />
7877
<Rule Id="SA1603" Action="Error" />
7978
<Rule Id="SA1609" Action="Error" />
80-
<Rule Id="SA1611" Action="None" />
79+
<Rule Id="SA1611" Action="None" />
8180
<Rule Id="SA1623" Action="None" />
8281
<Rule Id="SA1633" Action="None" />
8382
<Rule Id="SA1636" Action="Error" />

samples/OcelotBasic/OcelotBasic.csproj renamed to samples/OcelotBasic/Ocelot.Samples.OcelotBasic.ApiGateway.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
<PropertyGroup>
44
<TargetFramework>net7.0</TargetFramework>
5+
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
56
</PropertyGroup>
67

78
<ItemGroup>
8-
<PackageReference Include="ocelot" Version="18.0.0" />
9+
<Folder Include="Properties\" />
910
</ItemGroup>
1011

1112
<ItemGroup>
12-
<Folder Include="Properties\" />
13+
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
1314
</ItemGroup>
1415

15-
1616
</Project>

samples/OcelotBasic/Program.cs

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,40 @@
1-
using System.IO;
2-
1+
using Microsoft.AspNetCore.Builder;
32
using Microsoft.AspNetCore.Hosting;
43
using Microsoft.Extensions.Configuration;
5-
6-
using Ocelot.DependencyInjection;
7-
using Ocelot.Middleware;
4+
using Microsoft.Extensions.Hosting;
5+
using Microsoft.Extensions.Logging;
6+
using System.IO;
7+
8+
namespace Ocelot.Samples.OcelotBasic.ApiGateway;
89

9-
namespace OcelotBasic
10+
public class Program
1011
{
11-
public class Program
12+
public static void Main(string[] args)
1213
{
13-
public static void Main(string[] args)
14-
{
15-
new WebHostBuilder()
16-
.UseKestrel()
17-
.UseContentRoot(Directory.GetCurrentDirectory())
18-
.ConfigureAppConfiguration((hostingContext, config) =>
19-
{
20-
config
21-
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
22-
.AddJsonFile("appsettings.json", true, true)
23-
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
24-
.AddJsonFile("ocelot.json")
25-
.AddEnvironmentVariables();
26-
})
27-
.ConfigureServices(s =>
28-
{
29-
s.AddOcelot();
30-
})
31-
.ConfigureLogging((hostingContext, logging) =>
32-
{
33-
//add your logging
34-
})
35-
.UseIISIntegration()
36-
.Configure(app =>
37-
{
38-
app.UseOcelot().Wait();
39-
})
40-
.Build()
41-
.Run();
42-
}
14+
new WebHostBuilder()
15+
.UseKestrel()
16+
.UseContentRoot(Directory.GetCurrentDirectory())
17+
.ConfigureAppConfiguration((hostingContext, config) =>
18+
{
19+
config
20+
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
21+
.AddJsonFile("appsettings.json", true, true)
22+
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
23+
.AddJsonFile("ocelot.json")
24+
.AddEnvironmentVariables();
25+
})
26+
.ConfigureLogging((hostingContext, logging) =>
27+
{
28+
if (hostingContext.HostingEnvironment.IsDevelopment())
29+
{
30+
logging.ClearProviders();
31+
logging.AddConsole();
32+
}
33+
//add your logging
34+
})
35+
.UseIISIntegration()
36+
.UseStartup<Startup>()
37+
.Build()
38+
.Run();
4339
}
4440
}

samples/OcelotBasic/Properties/launchSettings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@
1111
"IIS Express": {
1212
"commandName": "IISExpress",
1313
"launchBrowser": true,
14+
"launchUrl": "posts/1",
1415
"environmentVariables": {
1516
"ASPNETCORE_ENVIRONMENT": "Development"
1617
}
1718
},
18-
"OcelotBasic": {
19+
"ApiGateway": {
1920
"commandName": "Project",
2021
"launchBrowser": true,
22+
"launchUrl": "posts/1",
2123
"environmentVariables": {
2224
"ASPNETCORE_ENVIRONMENT": "Development"
2325
},
2426
"applicationUrl": "https://localhost:5001;http://localhost:5000"
2527
}
2628
}
27-
}
29+
}

samples/OcelotBasic/Startup.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Microsoft.AspNetCore.Builder;
2+
using Microsoft.AspNetCore.Hosting;
3+
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.Hosting;
5+
using Ocelot.DependencyInjection;
6+
using Ocelot.Middleware;
7+
8+
namespace Ocelot.Samples.OcelotBasic.ApiGateway;
9+
10+
public class Startup
11+
{
12+
// This method gets called by the runtime. Use this method to add services to the container.
13+
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
14+
public void ConfigureServices(IServiceCollection services)
15+
{
16+
services.AddOcelot();
17+
services.AddLogging();
18+
}
19+
20+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
21+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
22+
{
23+
if (env.IsDevelopment())
24+
{
25+
app.UseDeveloperExceptionPage();
26+
}
27+
28+
app.UseOcelot().Wait();
29+
}
30+
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"Logging": {
33
"LogLevel": {
4-
"Default": "Information",
5-
"Microsoft": "Warning",
6-
"Microsoft.Hosting.Lifetime": "Information"
4+
"Default": "Debug",
5+
"Microsoft": "Information",
6+
"Microsoft.AspNetCore": "Information",
7+
"Microsoft.Hosting.Lifetime": "Information",
8+
"System": "Information"
79
}
810
}
911
}

samples/OcelotBasic/appsettings.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"Logging": {
33
"LogLevel": {
4-
"Default": "Information",
5-
"Microsoft": "Warning",
6-
"Microsoft.Hosting.Lifetime": "Information"
4+
"Default": "Warning"
75
}
86
},
97
"AllowedHosts": "*"

0 commit comments

Comments
 (0)