AVS-Carton-Shipment-Verifier/Hosting/KestrelConfiguration.cs

21 lines
574 B
C#

namespace AVSCartonShipmentVerifier.Hosting;
internal static class KestrelConfiguration
{
public static bool HasHttpsEndpoint(IConfiguration configuration)
{
var endpoints = configuration.GetSection("Kestrel:Endpoints").GetChildren();
foreach (var endpoint in endpoints)
{
var url = endpoint["Url"];
if (!string.IsNullOrWhiteSpace(url)
&& url.StartsWith("https://", StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}