Skip to content

Commit

Permalink
Merge pull request #74 from datalust/dev
Browse files Browse the repository at this point in the history
2.1 Maintenance Release
  • Loading branch information
nblumhardt authored Feb 22, 2024
2 parents 5e046f3 + a7198ca commit f1b851f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 91 deletions.
86 changes: 0 additions & 86 deletions src/Seq.Forwarder/Cli/Commands/BindSslCommand.cs

This file was deleted.

46 changes: 41 additions & 5 deletions src/Seq.Forwarder/Cli/Commands/RunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
using Serilog.Formatting.Compact;
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
Expand Down Expand Up @@ -97,8 +99,42 @@ protected override int Run(TextWriter cout)
})
.ConfigureWebHostDefaults(web =>
{
web.UseUrls(listenUri);
web.UseStartup<Startup>();
web.UseKestrel(options =>
{
options.AddServerHeader = false;
options.AllowSynchronousIO = true;
})
.ConfigureKestrel(options =>
{
var apiListenUri = new Uri(listenUri);

var ipAddress = apiListenUri.HostNameType switch
{
UriHostNameType.Basic => IPAddress.Any,
UriHostNameType.Dns => IPAddress.Any,
UriHostNameType.IPv4 => IPAddress.Parse(apiListenUri.Host),
UriHostNameType.IPv6 => IPAddress.Parse(apiListenUri.Host),
_ => throw new NotSupportedException($"Listen URI type `{apiListenUri.HostNameType}` is not supported.")
};

if (apiListenUri.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase))
{
options.Listen(ipAddress, apiListenUri.Port, listenOptions =>
{
#if WINDOWS
listenOptions.UseHttps(StoreName.My, apiListenUri.Host,
location: StoreLocation.LocalMachine, allowInvalid: true);
#else
listenOptions.UseHttps();
#endif
});
}
else
{
options.Listen(ipAddress, apiListenUri.Port);
}
});
})
.Build();

Expand Down Expand Up @@ -164,9 +200,9 @@ static string GetRollingLogFilePathFormat(string internalLogPath)
static int RunService(ServerService service)
{
#if WINDOWS
System.ServiceProcess.ServiceBase.Run(new System.ServiceProcess.ServiceBase[] {
new Seq.Forwarder.ServiceProcess.SeqForwarderWindowsService(service)
});
System.ServiceProcess.ServiceBase.Run([
new ServiceProcess.SeqForwarderWindowsService(service)
]);
return 0;
#else
throw new NotSupportedException("Windows services are not supported on this platform.");
Expand Down Expand Up @@ -204,7 +240,7 @@ static void WriteBanner()
Console.WriteLine();
Write(" Seq Forwarder", ConsoleColor.White);
Write(" ──", ConsoleColor.DarkGray);
Write(" © 2020 Datalust Pty Ltd", ConsoleColor.Gray);
Write(" © 2024 Datalust Pty Ltd", ConsoleColor.Gray);
Console.WriteLine();
Write("─", ConsoleColor.DarkGray, 47);
Console.WriteLine();
Expand Down

0 comments on commit f1b851f

Please sign in to comment.