Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
371d8cf
Add StyleCop.Analyzers package
raman-m May 30, 2023
3a76434
Fix SA0001: XML comment analysis is disabled due to project configura…
raman-m May 30, 2023
4ad5a37
Fix SA1609: Property documentation should have value
raman-m May 30, 2023
a017a9e
Fix CS1591: Missing XML comment for publicly visible type or member {…
raman-m May 30, 2023
eea5da1
Fix SA1101: Prefix local calls with this
raman-m May 30, 2023
a0e5c33
Fix SA1413: The last statement in a multi-line C# initializer or list…
raman-m May 30, 2023
b20924c
Fix SA1135: A using directive is not qualified.
raman-m May 30, 2023
0da791f
Fix compiler errors
raman-m May 30, 2023
8b10089
Fix SA1651: Do not use placeholder elements
raman-m May 30, 2023
cf1ae38
Fix compiling error
raman-m May 31, 2023
464584c
Fix SA1113: Comma should be on the same line as previous parameter
raman-m May 31, 2023
96a9fc6
Fix SA1116: The parameters should begin on the line after the declara…
raman-m May 31, 2023
a2be6d2
Fix SA1137: Elements should have the same indentation
raman-m May 31, 2023
6022c17
Fix SA1200: Using directive should appear within a namespace declaration
raman-m May 31, 2023
8e961a4
Fix SA1316: Tuple element names should use correct casing
raman-m May 31, 2023
0442748
Fix SA1503: Braces should not be omitted
raman-m May 31, 2023
9698d4f
Fix SA1505: An opening brace should not be followed by a blank line
raman-m May 31, 2023
26f5f42
Fix SA1507: Code should not contain multiple blank lines in a row
raman-m May 31, 2023
c57b1d6
Fix SA1508: A closing brace should not be preceded by a blank line
raman-m May 31, 2023
34f486a
Fix SA1512, SA1515
raman-m May 31, 2023
1a4cd7e
Fix SA1513: Closing brace should be followed by blank line
raman-m May 31, 2023
65a4da2
Fix SA1400: Element 'OpenTracingTracer' should declare an access modi…
raman-m May 31, 2023
d26781e
Fix SA1515: Single-line comment should be preceded by blank line
raman-m May 31, 2023
75c1973
Fix SA1518: File is required to end with a single newline character
raman-m May 31, 2023
5f90dd7
Add StyleCop
raman-m May 31, 2023
66a948c
Fix SA1633: A C# code file is missing a standard file header.
raman-m May 31, 2023
5193596
Disable SA1602: An item within a C# enumeration is missing an Xml doc…
raman-m May 31, 2023
3fdb703
Fix SA1600: Elements should be documented
raman-m May 31, 2023
632f0db
Fix SA1604: Element documentation should have summary
raman-m May 31, 2023
03f3c80
Fix SA1618: The documentation for type parameter 'T' is missing
raman-m May 31, 2023
a1b7265
Fix SA1629: Documentation text should end with a period.
raman-m May 31, 2023
adb6197
Fix SA1649: File name should match first type name
raman-m May 31, 2023
f14952d
Fix SA1600: Elements should be documented
raman-m May 31, 2023
273cfb4
Upgrade K8s sample to ASP.NET 7.
raman-m May 31, 2023
479f7d1
Upgrade K8s sample to ASP.NET 7.
raman-m May 31, 2023
6b04147
Fix CS0169: The field 'xxx' is never used
raman-m May 31, 2023
1a7478c
Fix CS0219: The variable 'baseUrl' is assigned but its value is never…
raman-m May 31, 2023
e18340f
Fix CS0414: The field 'xxx' is assigned but its value is never used
raman-m May 31, 2023
9068d7c
Fix CS1570: XML comment has badly formed XML
raman-m May 31, 2023
b0058df
Fix CS0649: Field 'xxx' is never assigned to, and will always have it…
raman-m May 31, 2023
19a9a7b
Fix CS0618: 'member' is obsolete: 'text'
raman-m May 31, 2023
a609841
Fix NU1504: Duplicate 'PackageReference' items found: Microsoft.Data.…
raman-m May 31, 2023
6b85103
Upgrade sample to ASP.NET 7
raman-m May 31, 2023
31f9c08
Fix NU5048: The 'PackageIconUrl'/'iconUrl' element is deprecated.
raman-m May 31, 2023
bdd1073
Rewrite a RequestDelegate object definition
raman-m May 31, 2023
e839937
Fix CS0618: 'member' is obsolete: 'text'
raman-m May 31, 2023
c489744
Fix CA1816: Change Dispose() to call GC.SuppressFinalize(object).
raman-m May 31, 2023
d0269d2
Fix CA1822: Member 'GivenThereIsAConfiguration' does not access insta…
raman-m May 31, 2023
65d22e8
Fix CA1837: Use 'Environment.ProcessId' instead of 'Process.GetCurren…
raman-m May 31, 2023
b458514
Fix CA2211: Non-constant fields should not be visible.
raman-m May 31, 2023
07e6b77
Fix IDE0060: Remove unused parameter 'path' if it is not part of a sh…
raman-m May 31, 2023
092aaa8
Fix CA1816: Change ConsulWebSocketTests.Dispose() to call GC.Suppress…
raman-m May 31, 2023
8ac815b
Fix IDE1006: Naming rule violation: These words must begin with upper…
raman-m May 31, 2023
6c98588
Fix IDE1006: Naming rule violation: These words must begin with upper…
raman-m May 31, 2023
c320153
Fix last issues
raman-m May 31, 2023
64e815b
Upgrade basic sample to ASP.NET 7
raman-m May 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions Ocelot.sln
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Kubernetes"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotBasic", "samples\OcelotBasic\OcelotBasic.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotBasic.ApiGateway", "samples\OcelotBasic\Ocelot.Samples.OcelotBasic.ApiGateway.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdministrationApi", "samples\AdministrationApi\AdministrationApi.csproj", "{B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}"
EndProject
Expand All @@ -64,9 +64,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "sample
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k8s", "k8s", "{4B706988-4817-43A8-ABE1-32A67998C2C8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiGateway", "samples\OcelotKube\ApiGateway\ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.ApiGateway", "samples\OcelotKube\ApiGateway\Ocelot.Samples.OcelotKube.ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "samples\OcelotKube\DownstreamService\DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.DownstreamService", "samples\OcelotKube\DownstreamService\Ocelot.Samples.OcelotKube.DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service-fabric", "service-fabric", "{B412628F-C325-47E1-A8D9-873DE04C8AF5}"
EndProject
Expand Down
9 changes: 4 additions & 5 deletions codeanalysis.ruleset
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for StyleCop.Analyzers" Description="Code analysis rules for StyleCop.Analyzers.csproj." ToolsVersion="15.0">
<RuleSet Name="Rules for StyleCop.Analyzers" Description="Code analysis rules for StyleCop.Analyzers.csproj." ToolsVersion="17.0">
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
<Rule Id="AvoidAsyncSuffix" Action="None" />
<Rule Id="AvoidAsyncVoid" Action="Error" />
Expand Down Expand Up @@ -50,12 +50,11 @@
<Rule Id="SA1209" Action="None" />
<Rule Id="SA1210" Action="None" />
<Rule Id="SA1214" Action="None" />
<Rule Id="SA1216" Action="None" />
<Rule Id="SA1216" Action="None" />
<Rule Id="SA1300" Action="None" />
<Rule Id="SA1302" Action="Error" />
<Rule Id="SA1303" Action="None" />
<Rule Id="SA1304" Action="Error" />
<Rule Id="SA1305" Action="None" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1310" Action="None" />
<Rule Id="SA1311" Action="Error" />
Expand All @@ -70,14 +69,14 @@
<Rule Id="SA1408" Action="None" />
<Rule Id="SA1410" Action="Error" />
<Rule Id="SA1411" Action="Error" />
<Rule Id="SA1412" Action="None" />
<Rule Id="SA1500" Action="None" />
<Rule Id="SA1502" Action="None" />
<Rule Id="SA1516" Action="None" />
<Rule Id="SA1600" Action="None" />
<Rule Id="SA1602" Action="None" />
<Rule Id="SA1603" Action="Error" />
<Rule Id="SA1609" Action="Error" />
<Rule Id="SA1611" Action="None" />
<Rule Id="SA1611" Action="None" />
<Rule Id="SA1623" Action="None" />
<Rule Id="SA1633" Action="None" />
<Rule Id="SA1636" Action="Error" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ocelot" Version="18.0.0" />
<Folder Include="Properties\" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
</ItemGroup>


</Project>
70 changes: 33 additions & 37 deletions samples/OcelotBasic/Program.cs
Original file line number Diff line number Diff line change
@@ -1,44 +1,40 @@
using System.IO;

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;

using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.IO;

namespace Ocelot.Samples.OcelotBasic.ApiGateway;

namespace OcelotBasic
public class Program
{
public class Program
public static void Main(string[] args)
{
public static void Main(string[] args)
{
new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
config
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
.AddJsonFile("ocelot.json")
.AddEnvironmentVariables();
})
.ConfigureServices(s =>
{
s.AddOcelot();
})
.ConfigureLogging((hostingContext, logging) =>
{
//add your logging
})
.UseIISIntegration()
.Configure(app =>
{
app.UseOcelot().Wait();
})
.Build()
.Run();
}
new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
config
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
.AddJsonFile("ocelot.json")
.AddEnvironmentVariables();
})
.ConfigureLogging((hostingContext, logging) =>
{
if (hostingContext.HostingEnvironment.IsDevelopment())
{
logging.ClearProviders();
logging.AddConsole();
}
//add your logging
})
.UseIISIntegration()
.UseStartup<Startup>()
.Build()
.Run();
}
}
6 changes: 4 additions & 2 deletions samples/OcelotBasic/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "posts/1",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"OcelotBasic": {
"ApiGateway": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "posts/1",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000"
}
}
}
}
30 changes: 30 additions & 0 deletions samples/OcelotBasic/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;

namespace Ocelot.Samples.OcelotBasic.ApiGateway;

public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddOcelot();
services.AddLogging();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseOcelot().Wait();
}
}
8 changes: 5 additions & 3 deletions samples/OcelotBasic/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Default": "Debug",
"Microsoft": "Information",
"Microsoft.AspNetCore": "Information",
"Microsoft.Hosting.Lifetime": "Information",
"System": "Information"
}
}
}
4 changes: 1 addition & 3 deletions samples/OcelotBasic/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
"Default": "Warning"
}
},
"AllowedHosts": "*"
Expand Down
2 changes: 1 addition & 1 deletion samples/OcelotBasic/ocelot.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"GlobalConfiguration": {
"BaseUrl": "https://localhost:5000"
}
}
}
13 changes: 6 additions & 7 deletions samples/OcelotEureka/ApiGateway/Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
using Ocelot.Provider.Eureka;
using Ocelot.Provider.Polly;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;

using Ocelot.DependencyInjection;
using Ocelot.Middleware;

namespace ApiGateway
{
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;

using Ocelot.DependencyInjection;
using Ocelot.Middleware;

public class Program
{
public static void Main(string[] args)
Expand Down
8 changes: 3 additions & 5 deletions samples/OcelotEureka/DownstreamService/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

using Steeltoe.Discovery.Client;

namespace DownstreamService
{
using Microsoft.Extensions.Hosting;

using Steeltoe.Discovery.Client;

public class Startup
{
public Startup(IConfiguration configuration)
Expand All @@ -34,7 +33,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
}

app.UseDiscoveryClient();
app.UseMvc();
}
}
}
17 changes: 9 additions & 8 deletions samples/OcelotKube/ApiGateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim AS base
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:2.1-stretch AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["ApiGateway/ApiGateway.csproj", "ApiGateway/"]
RUN dotnet restore "ApiGateway/ApiGateway.csproj"
COPY ["ApiGateway/Ocelot.Samples.OcelotKube.ApiGateway.csproj", "ApiGateway/"]
RUN dotnet restore "ApiGateway/Ocelot.Samples.OcelotKube.ApiGateway.csproj"
COPY . .
WORKDIR "/src/ApiGateway"
RUN dotnet build "ApiGateway.csproj" -c Release -o /app
RUN dotnet build "Ocelot.Samples.OcelotKube.ApiGateway.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ApiGateway.csproj" -c Release -o /app
RUN dotnet publish "Ocelot.Samples.OcelotKube.ApiGateway.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "ApiGateway.dll"]
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Ocelot.Samples.OcelotKube.ApiGateway.dll"]
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Ocelot" Version="18.0.0" />
<PackageReference Include="Ocelot.Provider.Kubernetes" Version="18.0.0" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Ocelot.Provider.Kubernetes\Ocelot.Provider.Kubernetes.csproj" />
<ProjectReference Include="..\..\..\src\Ocelot\Ocelot.csproj" />
</ItemGroup>

</Project>
Loading