Fix build and code structure improvements. New but essential UI functionality. CI improvements. Documentation improvements. AI module improvements.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
namespace StellaOps.Gateway.WebService.Configuration;
|
||||
|
||||
public static class GatewayOptionsValidator
|
||||
{
|
||||
public static void Validate(GatewayOptions options)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(options);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(options.Node.Region))
|
||||
{
|
||||
throw new InvalidOperationException("Gateway node region is required.");
|
||||
}
|
||||
|
||||
if (options.Transports.Tcp.Enabled && options.Transports.Tcp.Port <= 0)
|
||||
{
|
||||
throw new InvalidOperationException("TCP transport port must be greater than zero.");
|
||||
}
|
||||
|
||||
if (options.Transports.Tls.Enabled)
|
||||
{
|
||||
if (options.Transports.Tls.Port <= 0)
|
||||
{
|
||||
throw new InvalidOperationException("TLS transport port must be greater than zero.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(options.Transports.Tls.CertificatePath))
|
||||
{
|
||||
throw new InvalidOperationException("TLS transport requires a certificate path when enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
_ = GatewayValueParser.ParseDuration(options.Routing.DefaultTimeout, TimeSpan.FromSeconds(30));
|
||||
_ = GatewayValueParser.ParseSizeBytes(options.Routing.MaxRequestBodySize, 0);
|
||||
|
||||
_ = GatewayValueParser.ParseDuration(options.Health.StaleThreshold, TimeSpan.FromSeconds(30));
|
||||
_ = GatewayValueParser.ParseDuration(options.Health.DegradedThreshold, TimeSpan.FromSeconds(15));
|
||||
_ = GatewayValueParser.ParseDuration(options.Health.CheckInterval, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user