Skip to main content
NexusConfig implements Default, so build it with ..Default::default() - a new option in a later release then does not touch your call site.

Options

*api_key may be empty when wif.enabled = true.

Service endpoint

With endpoint empty or blank, the client reads the endpoint from WESTYX_SERVICE_ENDPOINT (westyx_nexus::SERVICE_ENDPOINT_ENV) when it is created. westyx dev run sets the variable for the script’s service, so together with a developer session an application started by it needs neither an endpoint nor a key:
  • A value in endpoint always wins; the variable is read only when the field is empty.
  • The variable is trimmed, and a value empty after trimming counts as unset.
  • It is validated like the field - https, or http on loopback only - and an error about its value names WESTYX_SERVICE_ENDPOINT rather than endpoint.
  • A value that is not UTF-8 is a configuration error, not “unset”.
  • With neither set, create returns NexusError::Config naming both.

Validation happens once, at construction

Every option is resolved and checked before the client exists. A rejection names the option and, for list options, the index - so the mistake is visible immediately instead of resurfacing days later as unexplained load or a stalled stream:
Rejected values: no endpoint and no WESTYX_SERVICE_ENDPOINT, an unparseable URL, a URL with no host, plain http on a non-loopback host, no credential at all, a ttl under one second, a 0 cooldown entry, and a cooldown above 24 hours.

Endpoint URL

The SDK sends the host as the Host header on every request (Double-Gate validation).

Choosing a TTL

With run_stream() active, events keep the cache fresh and the timer acts as a fallback - the configured interval still applies exactly as set.

Keeping the key secure

NexusClient implements Debug with the credential redacted, so logging the client cannot leak it. The SDK’s own tracing output never carries a key, a token or a secret value; secret key names do appear - see Logging.

WifConfig

WifConfig also implements Default.

Timeouts and limits

These are not configurable; they are chosen to match the backend’s behaviour.