faucet-common-nats
Shared configuration types for the faucet-stream
NATS source (faucet-source-nats)
and sink (faucet-sink-nats).
Both connectors depend on this crate and re-export its types, so end-user imports do not change.
Types
-
NatsAuth— authentication mode, serialized as the standard faucet{ type, config }adjacent tag:none(default) — anonymoustoken—{ token }user_password—{ username, password }nkey—{ nkey }(Ed25519 seed)creds_file—{ path }(annsc-produced.credsbundle)
Its
Debugimplementation is secret-safe:token,password, andnkeyare never printed. -
NatsConnectionConfig— the connection surface both connectors#[serde(flatten)]into their config:field type default description serversVec<String>["nats://127.0.0.1:4222"]server URLs (first reachable wins) authNatsAuthnoneauthentication mode tlsboolfalserequire a TLS connection nameOption<String>— client connection name (server monitor) -
connect(&NatsConnectionConfig) -> Result<async_nats::Client, FaucetError>— the single client builder both connectors use. Retry-on-initial-connect is left off, so an unreachable server fails immediately with a typed error.
Example (embedded in a connector config)
servers:
auth:
type: token
config:
token: ${env:NATS_TOKEN}
tls: false
name: faucet
License
Licensed under either of Apache-2.0 or MIT at your option.