namespace ZB.MOM.WW.OtOpcUa.Cluster;
///
/// Node-side selection of where a driver reads its deployed configuration (per-cluster mesh
/// Phase 3). The dark switch that lets a driver node stop reading Deployment.ArtifactBlob
/// from central SQL and instead fetch the artifact from central over gRPC and read it from the
/// pair-local LocalDb cache.
///
public sealed class ConfigSourceOptions
{
/// Configuration section name.
public const string SectionName = "ConfigSource";
/// Read config directly from central SQL — today's behaviour, and the default.
public const string ModeDirect = "Direct";
/// Fetch the artifact from central over gRPC, cache it in LocalDb, and read from there.
public const string ModeFetchAndCache = "FetchAndCache";
///
/// (default) or . Any other value
/// fails host start.
///
public string Mode { get; set; } = ModeDirect;
///
/// Central artifact-gRPC base addresses, e.g. http://central-1:4055 (h2c ⇒ the
/// http scheme). Tried in order for failover. Required under
/// ; ignored under .
///
public string[] CentralFetchEndpoints { get; set; } = [];
///
/// Shared bearer key; must equal central's . Supply via
/// the environment (ConfigSource__ApiKey) — never commit it. Required under
/// .
///
public string ApiKey { get; set; } = string.Empty;
/// Per-fetch deadline in seconds. Must be positive under .
public int FetchTimeoutSeconds { get; set; } = 30;
}
///
/// Central-side artifact-serve surface (per-cluster mesh Phase 3). Configures the dedicated h2c
/// listener + shared bearer key the DeploymentArtifactService is exposed behind. Only
/// admin-role nodes (which hold the central SQL connection) serve.
///
public sealed class ConfigServeOptions
{
/// Configuration section name.
public const string SectionName = "ConfigServe";
///
/// Dedicated HTTP/2-only (h2c) listener port for the artifact gRPC service. 0 (the
/// default) disables it — nothing is bound. Must differ from the main HTTP port and from
/// LocalDb:SyncListenPort (h2c cannot share a cleartext HTTP/1 port).
///
public int GrpcListenPort { get; set; }
///
/// Shared bearer key the serve-side interceptor checks (constant-time, fail-closed: an unset
/// key rejects every call). Supply via the environment (ConfigServe__ApiKey) — never
/// commit it.
///
public string ApiKey { get; set; } = string.Empty;
}