Skip to content

Configuration

Partial

Typed loaders and local environment wiring exist. Azure secret provisioning still requires deployed infrastructure evidence.

Code and tests

Configuration answers two questions:

  1. Where does a value come from?
  2. Which process is allowed to receive it?
flowchart LR
  Template[Checked-in template<br/>names and safe defaults] --> Loader[Service configuration loader]
  Local[Ignored local env file] --> Loader
  Vault[Azure Key Vault<br/>runtime secrets] --> Loader
  Loader -->|valid| Process[One app, API or worker]
  Loader -->|missing or invalid| Stop[Startup fails]

Copy values from the owning service’s .env.example or .env.template into an ignored local env file. Never edit the template with real credentials.

kesita dev up uses local PostgreSQL, Azurite and simulated providers. kesita dev up app --hybrid additionally reads infra/env/hybrid.env and connects local product services to the remote development Legal API and real model provider.

Run this after changing an environment contract:

Terminal window
pnpm env:check

The target Azure configuration supplies public settings and versioned Key Vault references through Terraform. Checked-in definitions do not establish deployed secret wiring.

flowchart TB
  Public[Public origins and feature settings] --> Runtime[Container environment]
  KeyVault[Versioned Key Vault secret] --> Runtime
  Identity[Managed workload identity] --> Azure[Authorized Azure resource]
  Runtime --> Service[Owning service]

Examples of ownership:

  • Product services receive product database and product blob access.
  • Legal Core receives read access to legal PostgreSQL and corpus originals.
  • The corpus worker receives legal worker access and corpus write access.
  • The product worker receives model-provider credentials.
  • The document parser receives a workload verification key, not database or storage credentials.

The model gateway is part of product-worker, so these values belong only to that process:

VariableSecretMeaning
ANTHROPIC_API_KEYyesAnthropic credential supplied to the product worker.
ANTHROPIC_BASE_URLnoProvider endpoint; defaults to https://api.anthropic.com. Deployed environments require HTTPS.
AIX_PROVIDER_CONCURRENCYnoMaximum admitted model operations for a provider/lane; bounds and defaults live in the worker config loader.
AIX_RECOVERY_EPOCHnoDeployment recovery fence used before model dispatch; required outside local/test.

Model, profile, and policy version are deliberately not environment variables. They come from services/product-worker/internal/modelgateway/policy.json, which is embedded in the worker binary. Startup validates every configured route against the provider registry and checked-in pricing catalogue; an unsupported provider or model fails startup instead of running without a cost bound.

Provider credentials and base URLs are process configuration, never task input or model-generated arguments. Do not put them in browser variables, workflow payloads, logs, traces, or persisted prompts. Local Compose uses the simulated Anthropic endpoint; hybrid development supplies the real key through the ignored hybrid environment file. The model remains selected by the checked-in worker policy.

Profiles and workspace pinning are described in Search configurations.

Only NEXT_PUBLIC_* values may enter the browser bundle. They are fixed when the image is built. Database URLs, signing keys and provider credentials are runtime-only and must never use that prefix.

For the service boundaries, see Deployment. For local commands, see Local development and Hybrid development.

scripts/env-check.mjs checks the environment contract. Process loaders such as services/product-worker/internal/config/config.go validate configuration before dispatch. Keeping secrets out of browser variables prevents their inclusion in a downloadable bundle; apps/kesita-app/platform/env/schema.ts separates public and server values. The model gateway startup and tests verify that selected models have a pinned cost entry.