HubConfig class
Configuration for an OmnyServerHub.
Critical dependencies (TLS material, authenticator) are required; everything else has a sensible default so a Hub can be embedded in a test or example with a couple of lines. Repositories, the event bus and the clock are injected for testability and pluggable persistence.
Constructors
-
HubConfig({required Authenticator authenticator, SecurityContext? securityContext, String? tlsDirectory, Duration tlsReloadInterval = const Duration(hours: 12), Object host = '0.0.0.0', int port = 8443, Authorizer? authorizer, String nodeMount = '/node', String shellMount = '/shell', List<
String> corsOrigins = const [], Duration heartbeatInterval = const Duration(seconds: 15), Duration heartbeatTimeout = const Duration(seconds: 45), Duration requestTimeout = const Duration(seconds: 30), Clock clock = const SystemClock(), IdGenerator idGenerator = const UuidGenerator(), EventBus? eventBus, NodeRepository? nodeRepository, AuditRepository? auditRepository, MetricRepository? metricRepository, FormulaRepository? formulaRepository, PresetRepository? presetRepository, GrantRepository? grantRepository, DesiredStateRepository? desiredStateRepository, StateReconciler? reconciler, List<AlertRule> alertRules = const [], Duration alertInterval = const Duration(seconds: 15), int logCapacityPerNode = 500, void logger(String message)?}) - Creates a Hub configuration.
Properties
- alertInterval → Duration
-
How often pending
offlinealerts are re-checked.final -
alertRules
→ List<
AlertRule> -
The conditions worth being told about (
disk>90,cpu>95 for 5m,offline for 2m).final - auditRepository → AuditRepository
-
Persists the audit trail.
final
- authenticator → Authenticator
-
Verifies credentials and resolves principals.
final
-
Decides whether a principal may perform an action.
final
- clock → Clock
-
Time source.
final
-
corsOrigins
→ List<
String> -
Browser origins allowed to call the HTTP API (e.g.
https://dashboard.example.com), or empty for none.final - desiredStateRepository → DesiredStateRepository
-
Persists the state each node is supposed to be in.
final
- eventBus → EventBus
-
The event bus the Hub publishes lifecycle/operational events on.
final
- formulaRepository → FormulaRepository
-
Persists formulas a site has registered beyond the built-ins.
final
- grantRepository → GrantRepository
-
Persists the credentials the Hub has issued at runtime.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- heartbeatInterval → Duration
-
How often nodes should heartbeat. Advertised to each node at registration.
final
- heartbeatTimeout → Duration
-
How long without a heartbeat before a node is considered stale/offline.
final
- host → Object
-
The bind host (string or InternetAddress).
final
- idGenerator → IdGenerator
-
Id generator (request ids, nonces, audit ids).
final
- logCapacityPerNode → int
-
How many log lines the Hub retains per node.
final
- logger → void Function(String message)?
-
Optional log sink.
final
- metricRepository → MetricRepository
-
Persists historical metric samples.
final
- nodeMount → String
-
The path the node control channel is mounted at.
final
- nodeRepository → NodeRepository
-
Persists node descriptors.
final
- port → int
-
The bind port (use 0 for an ephemeral port).
final
- presetRepository → PresetRepository
-
Persists the presets an operator has saved on the Hub.
final
- reconciler → StateReconciler
-
Plans how to move a node from what it is to what it should be.
final
- requestTimeout → Duration
-
How long to wait for a node to answer a dispatched operation.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- securityContext → SecurityContext?
-
The TLS context (server certificate chain + private key). Exactly one of
securityContext or tlsDirectory must be set: the Hub only speaks
wss, so there is no insecure mode.final - shellMount → String
-
The path an OmnyShell broker is mounted at, when the Hub hosts one.
final
- tlsDirectory → String?
-
A directory holding
fullchain.pem+privkey.pem(the LetsEncrypt layout), as an alternative to a static securityContext.final - tlsReloadInterval → Duration
-
How often the Hub re-checks tlsDirectory for a renewed certificate. Kept
below a day so a renewal is always picked up within 24h.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited