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.
Service endpoint
WithbaseUrl left empty, the client reads the endpoint from WESTYX_SERVICE_ENDPOINT when it is
created (NexusConfig.SERVICE_ENDPOINT_ENV names it). westyx dev run sets the variable for the
script’s service, so together with a Developer WIF session an application started by it needs
neither an endpoint nor a key in its code:
- A
baseUrlyou set always wins; the variable is read only when the field is empty or blank. - The variable is trimmed, and a value empty after trimming counts as unset.
- It is validated like the field -
https, orhttpon loopback only - and an error about its value namesWESTYX_SERVICE_ENDPOINTrather thanbaseUrl. - With neither set,
createthrowsNexusConfigExceptionnaming both.
TTL explanation
Thettl 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 comparesnow - syncedAtagainstttl. - If the snapshot is stale, a background coroutine syncs. The current call returns the cached value immediately - there is no blocking. While a 402, a quarantine or a switched-off environment holds the refresh, no sync starts.
- 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.
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 an ExchangeCredential -
an OIDC token or a signed aws_iam request - and the SDK writes the token-exchange body.
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.
