-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make kestrel limits configurable #520
Make kestrel limits configurable #520
Conversation
eduherminio
commented
Oct 14, 2020
- Allow Kestrel limits options to be overridden with values of config files and environment variables (see related Microsoft documentation).
Hello @eduherminio, I understand what you want to do, however adding this code currently breaks the CI because the And currently, setting the Kestrel options for netstandard 2.x and netstandard1.3 is done in (https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Owin/AspNetCoreSelfHost.NETStandard.cs) and (https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Owin/AspNetCoreSelfHost.NETStandard13.cs). So in case you want to override the KestrelServerLimits, this is the place to do it. And I think three more settings which should be set to a higher value:
However the question is if all these settings should be made configurable via WireMockSettings or just set to a large enough value so that users from WireMock.Net are not limited by the implementation. |
Codecov Report
@@ Coverage Diff @@
## master #520 +/- ##
==========================================
+ Coverage 76.50% 76.57% +0.07%
==========================================
Files 135 135
Lines 5248 5264 +16
Branches 517 518 +1
==========================================
+ Hits 4015 4031 +16
Misses 1079 1079
Partials 154 154
Continue to review full report at Codecov.
|
Hi @StefH! My idea was to try to provide a mechanism so that users of the container images can modify those limits without having to maintain both a fork of the project and the relevant image, by overriding the values in The same idea would apply to users of the library who need to modify those limits and don't want to maintain a fork of the project. Having said that, I respect that you don't like that approach and would be happy to have I also agree that |
OK I see your point. To make the main code (AspNetCoreSelfHost.cs) cleaner and use less
For the .netstandard1.3, there is no implementation, so just an empty extension method.
|
I've made the requested changes. Note that:
internal static IWebHostBuilder ConfigureKestrelServerOptions(this IWebHostBuilder builder)
{
var configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.Build();
return builder.ConfigureServices(services =>
{
services.Configure<KestrelServerOptions>(configuration.GetSection("Kestrel"));
});
} |
Looks good I think. However if you think that your comment is correct:
Then you can apply this code also for netstandard 1.3 |
|
||
internal static class IWebHostBuilderExtensions | ||
{ | ||
internal static IWebHostBuilder ConfigureAppConfigurationUsingEnvironmentVariables(this IWebHostBuilder builder) => builder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny ;-)
Implementations in an interface , first time I see this in a real project ;-)
@eduherminio However, can you test it using a MyGet preview version? Or a real NuGet and Docker? |
I'm happy to test a MyGet preview version later on the day using Docker. |
MyGet version is I don't have Docker previews, sorry. Maybe later today I can try to make a 1.3.3-preview-01 NuGet + Docker. |
Successfully tested by:
diff --git a/StandAlone.NETCoreApp/Dockerfile b/StandAlone.NETCoreApp/Dockerfile
index b41e637..a60e0f0 100644
--- a/StandAlone.NETCoreApp/Dockerfile
+++ b/StandAlone.NETCoreApp/Dockerfile
@@ -6,6 +6,7 @@ WORKDIR /app
# copy csproj and restore as distinct layers
COPY StandAlone.NETCoreApp.csproj ./
+COPY nuget.config ./^M
RUN dotnet restore
# copy everything else and build
diff --git a/StandAlone.NETCoreApp/StandAlone.NETCoreApp.csproj b/StandAlone.NETCoreApp/StandAlone.NETCoreApp.csproj
index 8def001..00f6587 100644
--- a/StandAlone.NETCoreApp/StandAlone.NETCoreApp.csproj
+++ b/StandAlone.NETCoreApp/StandAlone.NETCoreApp.csproj
@@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="WireMock.Net" Version="1.3.1" />
+ <PackageReference Include="WireMock.Net" Version="1.3.2-ci-13842" />
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/StandAlone.NETCoreApp/nuget.config b/StandAlone.NETCoreApp/nuget.config
new file mode 100644
index 0000000..55e3e1d
--- /dev/null
+++ b/StandAlone.NETCoreApp/nuget.config
@@ -0,0 +1,6 @@
+<EF><BB><BF><?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <packageSources>
+ <add key="MyGet" value="https://www.myget.org/F/wiremock-net/api/v3/index.json" />
+ </packageSources>
+</configuration>
\ No newline at end of file
From my point of view it's good to go 😃 😃 |
Thank you. I'll merge this one and create a new NuGet + docker. And sure: I'll use your wiki! Thanks. |