WestyxNexus.Extensions.Configuration
The SDK ships an IConfigurationSource / IConfigurationProvider implementation. With a single AddWestyx(...) call, all Nexus config values are exposed through IConfiguration — bind them to IOptions<T> classes, read them via configuration["key"], and receive live IOptionsMonitor<T> updates when a value changes in the console.
Choose this call when the application needs Nexus configs in IConfiguration and nothing else. It
creates a client the container never sees, so secrets binding, feature management and an injected
client need builder.AddWestyxNexus(config) instead.
Secrets are not included — only configs. See Secrets binding for the strongly-typed secret path, and Design decisions for why secrets stay out of IConfiguration by default.
Basic setup
AddWestyx performs a blocking initial sync inside Build() — the same pattern used by Azure App Configuration and other standard providers. All Nexus config values are available from the moment builder.Build() returns.
The SSE live-update stream starts automatically (enableStream: true is the default). Without it,
the client syncs once per TTL, and each sync that brings new data reloads the provider:
Binding to IOptions<T>
After callingAddWestyx, bind Nexus configs to a strongly-typed class the same way you would bind any other configuration section:
IOptions<DatabaseSettings> where you need it:
Live reload with IOptionsMonitor<T>
When the SSE stream is running, the configuration provider callsIConfiguration.Reload() automatically after every sync that returns new data. This means IOptionsMonitor<T> receives change notifications within milliseconds of a value being updated in the Nexus console — without a restart. While the stream is down, the client syncs once per TTL until it reconnects, and each sync that brings new data reloads the provider the same way.
Live reload requires
ConnectStream() to be active. AddWestyx(config) starts the stream automatically. If you use the pre-created client overload, call client.ConnectStream() yourself before registering the source.Pre-created client (WIF, advanced lifetime)
If you need WIF authentication or want to manage the client lifetime yourself, pass an existingNexusClient to the overload:
services.AddSingleton(_ => client), not services.AddSingleton(client): the
container disposes what a factory returns, and does not take ownership of an instance handed to it -
so the second form leaves the client’s SSE connection, polling timer and file-secret temp files in
place until the process exits. The service also has to be resolved at least once for the container
to have anything to dispose.
If you do not need to create the client yourself,
builder.AddWestyxNexus(config) handles all of this: one client for
IConfiguration and the container, disposed with the host.
Reading configs directly from IConfiguration
You can also read Nexus config values directly without binding to a class:Key shapes
A Nexus keydatabase.host is reachable two ways, and both are supported deliberately:
Nested objects and arrays
A JSON object or array config value is flattened the way the built-in JSON provider does it, so it binds to a POCO or a collection:Value type serialization
Nexus config values are JSON. The provider serializes them to strings for IConfiguration:
Standard binding (
IOptions<T>) handles all of these natively.
IConfiguration matches property names case-insensitively but not across an underscore, so a key checkout.max_items does not bind to MaxItems on its own. Name the property for the key with [ConfigurationKeyName("max_items")]. (Secrets binding maps api_key to ApiKey itself.)
What cannot come from Nexus
Host settings that are read before configuration sources load - the environment name above all,DOTNET_ENVIRONMENT / ASPNETCORE_ENVIRONMENT - must be set on the process. See Environment name.
Combining with other configuration sources
AddWestyx stacks with the other sources in the builder. The last source wins for duplicate keys — so to let local environment variables override Nexus values (useful during development), add Nexus before environment variables:
appsettings.json but lower than environment variables:
