Skip to content

Commit

Permalink
#54: Bring back the static port and make it configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
sevensolutions committed Jun 8, 2024
1 parent 9c93a08 commit d6de30d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Feel free to use it as-is or as a reference implementation for your own C#-based

```hcl
plugin "nomad_iis" {
#args = ["--port 1234"] # Optional. To change the static port. The default is 5003.
#args = ["--port 0"] # Optional. To use a random port
config {
enabled = true,
fingerprint_interval = "30s",
Expand Down
9 changes: 7 additions & 2 deletions src/NomadIIS/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
Expand Down Expand Up @@ -41,8 +42,12 @@

//System.Diagnostics.Debugger.Launch();

builder.WebHost.ConfigureKestrel( config => {
config.Listen( IPAddress.Loopback, 0, listenOptions => {
builder.WebHost.ConfigureKestrel( config =>
{
var port = builder.Configuration.GetValue( "port", 5003 );
config.Listen( IPAddress.Loopback, port, listenOptions =>
{
listenOptions.Protocols = HttpProtocols.Http2;
} );
//config.ListenUnixSocket("/my-socket2.sock", listenOptions =>
Expand Down

0 comments on commit d6de30d

Please sign in to comment.