111 lines
3.4 KiB
C#
111 lines
3.4 KiB
C#
using StellaOps.Router.Common.Enums;
|
|
using StellaOps.Microservice.AspNetCore;
|
|
|
|
namespace StellaOps.Router.AspNet;
|
|
|
|
/// <summary>
|
|
/// Base configuration options for Stella Router integration that can be embedded
|
|
/// in any WebService's options class. Services should include a property of this type
|
|
/// named "Router" to enable Router integration.
|
|
/// </summary>
|
|
/// <example>
|
|
/// <code>
|
|
/// public class MyServiceOptions
|
|
/// {
|
|
/// public StellaRouterOptionsBase? Router { get; set; }
|
|
/// }
|
|
/// </code>
|
|
/// </example>
|
|
public class StellaRouterOptionsBase
|
|
{
|
|
/// <summary>
|
|
/// Enable Stella Router integration. When true, ASP.NET endpoints
|
|
/// are automatically registered with the Router for discovery and dispatch.
|
|
/// Default: false.
|
|
/// </summary>
|
|
public bool Enabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// Deployment region for this service instance.
|
|
/// Default: "default".
|
|
/// </summary>
|
|
public string Region { get; set; } = "default";
|
|
|
|
/// <summary>
|
|
/// Default request timeout in seconds.
|
|
/// Default: 30 seconds.
|
|
/// </summary>
|
|
public int DefaultTimeoutSeconds { get; set; } = 30;
|
|
|
|
/// <summary>
|
|
/// Heartbeat interval in seconds for health reporting.
|
|
/// Default: 45 seconds.
|
|
/// </summary>
|
|
public int HeartbeatIntervalSeconds { get; set; } = 45;
|
|
|
|
/// <summary>
|
|
/// Maximum interval in seconds between HELLO refreshes on an already-live transport.
|
|
/// Default: 10 seconds to keep gateway restarts from leaving the frontdoor cold for minutes.
|
|
/// </summary>
|
|
public int RegistrationRefreshIntervalSeconds { get; set; } = 10;
|
|
|
|
/// <summary>
|
|
/// Service trust mode for gateway-enforced authorization semantics.
|
|
/// Default: Hybrid.
|
|
/// </summary>
|
|
public GatewayAuthorizationTrustMode AuthorizationTrustMode { get; set; }
|
|
= GatewayAuthorizationTrustMode.Hybrid;
|
|
|
|
/// <summary>
|
|
/// Shared signing key used to verify gateway identity envelopes.
|
|
/// Required when AuthorizationTrustMode is GatewayEnforced.
|
|
/// </summary>
|
|
public string? IdentityEnvelopeSigningKey { get; set; }
|
|
|
|
/// <summary>
|
|
/// Allowed clock skew in seconds when validating gateway identity envelopes.
|
|
/// Default: 30 seconds.
|
|
/// </summary>
|
|
public int IdentityEnvelopeClockSkewSeconds { get; set; } = 30;
|
|
|
|
/// <summary>
|
|
/// Gateway endpoints to connect to for endpoint registration.
|
|
/// </summary>
|
|
public IList<StellaRouterGatewayOptionsBase> Gateways { get; set; } = new List<StellaRouterGatewayOptionsBase>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Base configuration for a Router gateway connection.
|
|
/// </summary>
|
|
public class StellaRouterGatewayOptionsBase
|
|
{
|
|
/// <summary>
|
|
/// Gateway host.
|
|
/// Default: "localhost".
|
|
/// </summary>
|
|
public string Host { get; set; } = "localhost";
|
|
|
|
/// <summary>
|
|
/// Gateway port.
|
|
/// Default: 9100.
|
|
/// </summary>
|
|
public int Port { get; set; } = 9100;
|
|
|
|
/// <summary>
|
|
/// Transport type (InMemory, Tcp, Tls, Messaging).
|
|
/// Default: InMemory.
|
|
/// </summary>
|
|
public TransportType TransportType { get; set; } = TransportType.InMemory;
|
|
|
|
/// <summary>
|
|
/// Enable TLS for TCP transport.
|
|
/// Default: false.
|
|
/// </summary>
|
|
public bool UseTls { get; set; }
|
|
|
|
/// <summary>
|
|
/// TLS certificate path (if UseTls is true).
|
|
/// </summary>
|
|
public string? CertificatePath { get; set; }
|
|
}
|