Environment Variables
Local orchestration composes reviewed environment layers; hosted services still own and validate their exact production variables independently.
Common Variables
| Variable | Services | Notes |
|---|---|---|
| NODE_ENV | Web, API, Gateway, Worker | production on Railway. |
| PORT | Web, API, Gateway, Worker | Injected by Railway for the running container. |
| SERVICE_NAME | Web, API, Gateway, Worker | Must match the package literal. |
| PUBLIC_WEB_ORIGIN | Web, API, Gateway, Worker | Browser-facing web origin. |
| HOSTED_ACTIVITY_TOKEN | Web and API | Optional shared server-side secret for activity reporting on a dedicated non-enterprise hosted instance. Use the same random base64url value of 32–128 characters on both services. Keep it unset on mixed-tenant installations. |
| HOSTED_DOCUMENT_ACTIVITY_ENABLED | Worker | Derived from the Web and API collection settings during release preparation. Records hosted document-generation exchanges in private object storage. |
| API_PUBLIC_URL | Web, API, Gateway, Worker | Browser-facing API URL. The hosted Windows WSL Downloads command supplies it as both -ApiUrl and -ArtifactUrl. |
| GATEWAY_PUBLIC_URL | Web, API, Gateway, Worker | Browser-facing gateway URL. The hosted Windows WSL Downloads command supplies it as -GatewayUrl. |
Enable Invitation Email And Provider Sign-In
- Enable Email Sending for the sender domain in Cloudflare. On the API service, set INVITE_EMAIL_FROM to an address on that domain, INVITE_EMAIL_ACCOUNT_ID to the account that owns it, and INVITE_EMAIL_API_TOKEN to an account token with the Email Sending Edit permission. Set PUBLIC_WEB_ORIGIN to the public Web address used in invitation links.
- Railway preserves the three sender settings together when redeploying. A partial group fails validation. With email disabled, invite an existing user by handle. To verify email, send an invitation from workspace Members to a mailbox you control. A sent status means the provider accepted or queued the message. Open the link from the inbox to confirm delivery. After a failed attempt, correct the sender settings and choose Resend email.
- To enable Google and GitHub sign-in in production, set OAUTH_ENABLED=true on the API, provide GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET, GITHUB_OAUTH_CLIENT_ID and GITHUB_OAUTH_CLIENT_SECRET, and set OAUTH_REDIRECT_BASE_URL to the public OAuth callback base. Register that base followed by /identity/oauth/google/callback with Google and /identity/oauth/github/callback with GitHub.
Production Guards
- For PostgreSQL repository credentials, set PROJECT_REPOSITORY_CREDENTIAL_KEYS to a JSON object of base64-encoded 32-byte keys and set PROJECT_REPOSITORY_CREDENTIAL_ACTIVE_KEY_ID to the ID for new writes. Startup and Railway preflight reject an invalid keyring even when a legacy single key exists. Production also rejects the public disposable example key. Retain previous protected keys until migration and backup recovery are verified.
- Signing and credential requirements are deployment-profile-specific. Enterprise hosted profiles use versioned KMS/HSM and workload identity; the PostgreSQL production profile has separate versioned signing/envelope contracts. Use the typed env schema and approved provider guide, not cross-profile substitutions.
- Gateway signing follows the selected verified provider profile. TLS key material remains certificate-scoped and must not be reused as a signing key.
- Worker production process-mode scans run from the pinned worker image; container-mode scans require PACKAGE_SECURITY_SCANNER_IMAGE_DIGEST.
- Metrics bearer tokens are required whenever production metrics are enabled.
Protected Local Windows WSL Profile
- The onboarding wizard owns .local/wsl-hacp-onboarding/sigroom-wsl.env. Local start and health commands load the base environment, generated TLS/signing environment, then that mode-600 marker-owned profile.
- The profile explicitly configures protected Linux temporary storage, localhost origins and CA trust, self-service enrollment, the exact Windows workspace allowlist, the local GeneSYS kill switch, L4/L5 mode, manual or autonomy admission, canonical signed launch-rootfs measurement, stable launch/Gateway verification descriptors, release trust, PACKAGE_SECURITY_RELEASE_BLOCKING_ENABLED=true, and optional bounded model access. Disabled TPM/model/inference/rotation values are cleared rather than inherited; hosted harness admission comes from versioned database policies.
- Direct local processes receive only service-owned private material; Compose maps reviewed variables per container. Direct processes use REDIS_URL on localhost while containers use REDIS_INTERNAL_URL.
- Do not source, edit, commit, or copy the protected profile. Rerun onboarding when its release or path changes. SIGROOM_LOCAL_ENV_OVERRIDE_FILE remains an advanced explicit CI/recovery override.
- Only the default local-process stack is qualified. Docker/hybrid application-service WSL L5, the separate PROJECT_TEST_* Linux Worker role, and all hosted values are outside this local contract.
Source Material
- ops/railway/env-matrix.md
- .env.local.example
- docs/deployment/runtimes/windows-wsl2/local-development-walkthrough.md
- ops/hacp-control/onboard-wsl-hacp.sh
- scripts/local/run-full-stack.sh
- scripts/local/start-services.sh
- scripts/local/check-health.sh
- scripts/local/ensure-gateway-tls-env.sh
- apps/api/src/env.ts
- apps/api/src/modules/invites/email.ts
- apps/api/src/modules/identity/oauth.ts
- apps/gateway/src/env.ts
- apps/worker/src/env.ts
- apps/web/src/env.ts