Skip to main content
NexusConfig is the single configuration object passed to NexusClient.create(). All fields are immutable after construction. Every field is validated once, at create. A rejected value raises NexusConfigException naming the option, the offending value and - for a list option - the index. Nothing is coerced: a coerced mistake resurfaces days later as unexplained load or a stalled stream with nothing pointing at the cause.

NexusConfig

Field reference

NexusConfig.toString() redacts apiKey, since a config is often printed while debugging.

TTL explanation

The ttl controls how stale the local in-memory snapshot can get before the SDK triggers a background refresh.
  • On every getter call (getString, getBoolean, etc.), an internal freshness check compares now - syncedAt against ttl.
  • If the snapshot is stale, a background coroutine syncs. The current call returns the cached value immediately - there is no blocking.
  • Concurrent stale reads coalesce: a burst produces one sync plus at most one follow-up, not one per read.
  • The stream push path (connectStream) bypasses the TTL entirely: when a push event arrives, a sync runs regardless.
Recommended values:

WifConfig

WifCredential

WifCredential.Auto() probes the environment - stat-ing token files and live-probing the metadata servers - and picks the first that has credential material. Its audience applies to the GCP path, the only probed credential that requests one. aws_iam is never auto-detected, and the developer credential is always considered last. WifCredential.Custom takes an ExchangePayloadProvider, which returns the whole POST /v1/auth/token-exchange body rather than a bearer string, so a credential that is not an OIDC token can be expressed. oidcTokenProvider { ... } adapts a plain token supplier. An Azure audience that is blank or the generic westyx-nexus default is rejected at construction: Azure AD does not accept it as a resource, and the SDK never substitutes an ARM token. See Workload identity for full provider details.

Minimal configs

API key only

WIF with auto-detection

Custom TTL, observer, reconnect schedule and logger