Environments and promotion
Section titled “Environments and promotion”An external client is written once and run against more than one deployment — a development space, a staging space, production. This page is about what actually differs between those deployments from a client’s point of view, so that promoting a client from one to the next is a change of configuration and never a change of code. It stays close to what the OSOS platform genuinely exposes; the generic parts of CI hygiene are kept brief on purpose.
What actually changes between environments
Section titled “What actually changes between environments”Less than you might expect. The API contract — routing, versioning, the response envelope, the error model — is identical across deployments; that is the whole point of documenting it. What changes per environment is narrow:
- the base URL the client talks to;
- the credential the client presents.
Everything a client holds should reduce to those two values. If anything else has to change to move between environments, treat that as a defect in the client’s configuration boundary, not a fact of the platform.
The base URL is the tenant
Section titled “The base URL is the tenant”You do not address services individually. Every call goes to the gateway, and the gateway resolves which tenant you are talking to from the request host — the domain-resolver and space-resolver plugins look the incoming Host up against the registered domains and stamp the tenant’s x-space-id onto the request before any service sees it.
The practical consequence: the base URL is not merely an address, it is the tenant selector. A development space and a production space are reached at different hosts, and pointing a client at a different host silently changes which space’s data it reads and writes. So:
- The base URL belongs in configuration, never hard-coded.
- There is no
x-space-idfor a client to set — the gateway derives it from the host, and a client that tries to set tenancy headers itself is both ineffective and a red flag (see The security boundary). - Confirm the host before a write. Promoting a job that was pointed at staging to run against a production host is a data incident, not a config typo.
Credentials are per-environment
Section titled “Credentials are per-environment”A credential minted in one space does not — and must not — work in another. Credentials are the second and last thing that changes on promotion.
Application tokens
Section titled “Application tokens”The simplest headless credential is an application token, minted for a dedicated application user and presented as the x-app-token header. A token is issued per application user per space, so each environment has its own. The token carries no permissions of its own; its access is exactly the owning application user’s roles, membership and view permissions in that space (see Choosing a credential). Provision a separate application user, with least privilege, in each environment.
OAuth client credentials
Section titled “OAuth client credentials”When the client acts on behalf of an interactive user, it uses the OAuth 2.0 / OIDC path served by users-service, with a client id and secret registered for that deployment. Those, too, are per-environment values: a staging client secret is not a production client secret. They belong in the same configuration boundary as the base URL and are subject to the same rule below about never being baked into an artifact.
What stays server-side
Section titled “What stays server-side”Some secrets belong to the platform’s internal trust and must never reach a client at all. The shared key (SHARED_KEY) is the preshared secret the gateway uses to authenticate itself to downstream services; it is required in any non-development environment and the process refuses to start without it (getSharedKey). A development fallback value exists for local runs only.
A client never holds the shared key, never sets identity headers such as x-user-id or x-space-id, and never talks to a service port directly — all of that is the gateway’s job, and a client in a position to do any of it is a boundary that has already failed. The security boundary covers why in full. When you promote a client, the only material it carries between environments is a base URL and its own credential; the server-side trust material is configured on the platform and stays there.
Never bake a credential into an artifact
Section titled “Never bake a credential into an artifact”An application token is bearer material: whoever holds it acts as its application user. Treat it exactly as you would a password.
- Never commit a token or client secret to source control, and never bake one into a built artifact — a container image, a compiled bundle, a published package. An artifact is copied, cached and shared; a credential inside it leaks with it.
- Inject credentials at deploy time from the environment or a secrets manager, keyed by environment. The base URL travels the same way.
- Rotate on a schedule and on any suspected exposure. Application tokens support rotation with a grace window so an in-flight token keeps working while callers pick up the new one — see Token lifecycle; design your deployment so a rotation is a config push, not a redeploy.
A promotion pattern
Section titled “A promotion pattern”A clean setup keeps code identical across environments and varies only configuration:
- One build artifact, promoted unchanged from staging to production. If the artifact differs per environment, a credential or URL has leaked into it.
- Base URL and credential supplied as environment configuration or mounted secrets, selected by the target environment at deploy time.
- A pre-promotion check that the resolved host is the intended one, so a client cannot run against the wrong tenant.
- Distinct, least-privilege application users per environment, so revoking or rotating one never touches another.
Checklist
Section titled “Checklist”- Exactly two things change between environments: the base URL and the credential.
- The base URL selects the tenant — verify the host before any write.
- Separate, least-privilege credentials per environment; never reuse across spaces.
- The shared key and all identity headers stay server-side; a client never holds or sets them.
- No credential in source, in an image, or in any built artifact — inject at deploy time.
- Rotate credentials as configuration, using the grace window to avoid downtime.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27