Settings
Settings are runtime switches that change how sxs behaves: execution limits, output formats, dataset lifecycle rules, worker and queue tuning, and so on. They are different from the global configuration variables that wire the process to its databases, buckets and services.
Principle
A setting has a default, usually defined by an environment variable, and can be overridden at more specific levels. When sxs reads a setting it takes the most specific value that is defined, in this order:
- Environment — the value set at deployment (Kubernetes variable or
.env). - Space — a property on the space in the tenant configuration.
- Dataset annotation — for the few settings that support it.
- Default — the value declared in the settings registry.
Every setting is declared in the settings registry, with an environment name and a matching space property. The space property is simply the lower-cased environment name in camelCase:
Why
- Configure once, adjust per space — set a sensible default at deployment, then tune a single space (a heavy data space, a test space) without touching the others.
- Environment changes need a restart; space changes do not — space values are read from the tenant configuration, which sxs refreshes periodically (about once a minute). Environment values are read at boot.
- Safety — a variable present in
.envis not automatically a setting. Only the entries declared in the settings registry are honoured, so unrelated environment variables never silently change behaviour.
How to use it
At deployment (environment default)
Set the environment variable — for example in the Kubernetes manifest — to define the value for the whole deployment. This requires a restart to take effect.
Per space (tenant configuration)
Add the space property to the space object in tenants.json:
A space value overrides the environment default for that space only. It is picked up when the tenant configuration refreshes, with no restart.
Per dataset (annotation)
A few settings can be enabled through a dataset annotation instead of a value. These are marked as annotation settings in the registry and are useful to change behaviour for a single dataset without affecting its space.
Which level applies
Some settings are global only: they are read once at boot (for example the worker and export pool sizes), so a space override is not consulted.
Full reference
The complete list of settings — environment name, space property, type, default
and scope — is in Configuration and settings, together with
the global variables they are often confused with. The registry itself lives in
src/server/init/settings.js.
