Docs / Reference7 min readEdit on GitHub

Environment variables#

Illume's backend is configured by one Pydantic Settings class in app/core/config.py, read from the process environment and server/.env. A handful of variables bypass Settings and are read straight from os.environ, the web and mobile clients each read one public variable, and the test, end-to-end, eval and production-smoke harnesses have their own. This page lists every one of them, what reads it, its default, and what happens when it is empty. It contains no values.

Terms used on this page#

  • Required: the field has no default, so Settings() raises a pydantic ValidationError at import time when it is missing. An empty string still counts as present.
  • Operator: whoever runs the Illume deployment and pays for its server-side keys.
  • Free tier: requests from users without their own AI key, which run on the operator's AI_API_KEY. See BYOK and encryption.

How settings load#

flowchart LR
  ENV["process environment"] --> S["Settings()"]
  DOT["server/.env"] --> S
  S --> G["settings singleton<br/>in app.core.config"]
  G --> APP["API, worker, beat,<br/>Alembic, scripts"]
  OS["os.environ only"] --> TR["tracing.py,<br/>OpenAI SDK"]
  • model_config = SettingsConfigDict(env_file=".env", extra="ignore"). The environment wins over .env; unknown variables are ignored.
  • settings = Settings() runs when app.core.config is first imported. Always import that object (from app.core.config import settings); never construct Settings() yourself.
  • Every process that imports anything under app needs the full set of required fields. A fresh checkout, a CI job or a standalone script fails at import otherwise. When a process does not need configuration, move its import rather than adding an environment block; server/scripts/openai_stub_server.py stays configuration-free by importing its one constant from tests/fixtures/openai_stub.
  • .env is gitignored. server/.env.example lists every variable with comments.
  • In a development checkout, server/.env points at production. Alembic reads SYNC_DATABASE_URL from it, so alembic upgrade head from a laptop migrates the production database. See changing the schema.

Backend Settings fields#

VariableTypeDefaultRead byWhen empty or wrong
DATABASE_URLstrrequiredasync engine (postgresql+asyncpg://) in core/database.pythe API cannot start
SYNC_DATABASE_URLstrrequiredsync engine (postgresql://, psycopg2): Celery tasks, Alembic, scriptsthe worker and migrations cannot connect
REDIS_URLstrrequiredCelery broker and results, ingest log channel, run slots, rate limitsno ingests, no live progress
OPENAI_API_KEYstrrequiredembeddings (text-embedding-3-small) in embedder.py and retrievalingest fails at embedding; chat cannot embed the question
AI_MODELstrrequiredLLMConfig.server_default() onlyempty means the DeepSeek registry default
AI_API_KEYstr""LLMConfig.server_default(), the free tierthe free tier is off: a keyless user gets 402
AI_BASE_URLstr""LLMConfig.server_default()empty means https://api.deepseek.com, without /v1
OPENROUTER_API_KEYstr""the Jev decider and reranker, the Cohere reranker, the auto routerJev and Cohere are unavailable; reranks answer from the fused order, decisions fall back to the user's model, auto runs structural
ACCESS_TOKEN_EXPIRE_MINUTESintrequiredcore/security.py, web JWT lifetime
MOBILE_TOKEN_EXPIRE_MINUTESint129600 (90 days)JWTs for requests with X-Illume-Client: mobile
SECRET_KEYstrrequiredJWT signing (HS256)rotating it signs everyone out
CREDENTIAL_ENCRYPTION_KEYstrrequiredcore/crypto.py, encrypting AI keys and GitHub tokensat least 32 characters; losing it makes every stored credential unreadable
CREDENTIAL_ENCRYPTION_KEY_PREVIOUSstr""core/crypto.py, decryption fallbackscomma-separated earlier keys, for rotation without re-encryption
FRONTEND_URLstrrequiredCORS allowed origin, OAuth redirectsthe browser's requests are refused by CORS
ENVIRONMENTstr"development"the session cookie is Secure only when this is production
DOMAINstrrequiredthe session cookie's Domain attributea bare hostname: a scheme or port makes the cookie invalid, so logins silently do not stick
GITHUB_CLIENT_IDstrrequiredGitHub OAuth
GITHUB_CLIENT_SECRETstrrequiredGitHub OAuth
GITHUB_REDIRECT_URLstrrequiredGitHub OAuth callback
OAUTH_REDIRECT_ALLOWLISTlist[]the OAuth callback's redirect_uri for native clientsexact matches only; empty disables the parameter
RESEND_API_KEYstrrequiredthe contact formempty: the contact endpoint answers 503
CONTACT_TO_EMAILstrrequiredthe contact form's recipientempty: 503
CONTACT_FROM_EMAILstrrequiredthe contact form's Froma bare address on a Resend-verified domain, no quotes or display name

Notes:

  • The contact variables are required but may be empty: the field must exist, but an empty value disables the endpoint rather than failing start-up.
  • OAUTH_REDIRECT_ALLOWLIST is a list; pydantic-settings parses it from JSON (["illume://auth/callback"]). Typical entries are the production app scheme and the Expo development client's.
  • CONTACT_FROM_EMAIL is passed through Docker's --env-file, which does no quote processing, so quotes would become part of the value.
  • Tunable constants for auto-update, the clone cache, retrieval and the agent are deliberately not settings; they are module-level constants changed by a code change and a deploy. See constants.

Variables read outside Settings#

VariableRead byEffect
OPENAI_BASE_URLthe OpenAI SDK itself, for the embedding clientredirects every embedding call. The end-to-end suite points it at a stub. Never pass base_url to the embedding client in code; this variable is the seam
LANGSMITH_TRACINGservices/tracing.pytracing of the chat path is on only when this is true
LANGSMITH_API_KEYtracing.py, the LangSmith clientmust also be non-empty for tracing
LANGSMITH_PROJECTthe LangSmith clientthe project runs are filed under
LANGSMITH_HIDE_INPUTSthe LangSmith clientset in production, so questions and context are not uploaded
LANGSMITH_HIDE_OUTPUTSthe LangSmith clientset in production, so answers are not uploaded

Both tracing checks are read from os.environ on every call, so an environment without them behaves as if tracing did not exist. Only the chat and agent path is wrapped; ingestion and sync model calls are never traced.

Git subprocesses run with GIT_ASKPASS=echo, GIT_TERMINAL_PROMPT=0, and GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM set to the null device (repo_cache._git_env), so a credential prompt fails fast and a developer's git configuration cannot change how an untrusted remote is fetched. These are set by the code, not by the operator.

Clients#

VariableAppMeaning
NEXT_PUBLIC_BACKEND_URLweb client (client/)the API's absolute origin. Used by server components, server actions, client fetches and the WebSocket (with http swapped for ws). Inlined at build time
EXPO_PUBLIC_BACKEND_URLmobile app (mobile/)the same, for the Expo app
CIthe end-to-end Playwright configurationforbids .only, switches reporters, and never reuses running servers

There is no rewrites in next.config.ts: the browser talks to the backend origin directly, so FRONTEND_URL and NEXT_PUBLIC_BACKEND_URL must agree with each other for CORS and cookies to work.

Test and harness variables#

Backend tests#

server/tests/conftest.py sets every required field with os.environ.update before app.core.config is imported, pointing at the test stack (Postgres on 5433, Redis on 6380), and asserts the database port is a test-stack port. Fields it does not set, notably AI_API_KEY and OPENROUTER_API_KEY, fall through to server/.env on a developer machine, which CI does not have. To reproduce CI locally:

AI_API_KEY= OPENROUTER_API_KEY= uv run pytest

PYTEST_XDIST_WORKER is read by the sample-repository fixture to keep workers' clones apart. See backend testing.

End-to-end tests#

client/e2e/env.ts defines the environment for every server process Playwright starts, in one place, so the configuration and the seed script cannot drift apart.

VariableDefaultPurpose
E2E_CLIENT_PORT3000Next.js port
E2E_API_PORT8000API port
E2E_STUB_PORT8099the OpenAI-compatible stub server
E2E_BASE_URLhttp://localhost:8000scripts/seed_e2e.py: API to seed against
E2E_EMAIL, E2E_PASSWORD, E2E_NAMEtest valuesthe seeded account
E2E_SEED_OUTPUTe2e-seed.jsonwhere the seed writes what it created

The suite's server environment sets OPENAI_BASE_URL and AI_BASE_URL to the stub and DOMAIN=localhost. localhost, not 127.0.0.1, matters: the cookie domain must match the host the browser uses. See frontend and end-to-end tests.

Evals#

The eval harness never reads server/.env. Importing evals/settings.py rewrites os.environ with every Settings field pinned to the isolated eval stack (Postgres on 5434, Redis on 6381), refuses to run if app.core.config was already imported against another stack, and asserts every URL is local. Keys come from server/evals/.env.eval:

KeyPurpose
OPENAI_API_KEYembeddings
AI_API_KEY, AI_BASE_URLthe generator
OPENROUTER_API_KEYJev and Cohere
GITHUB_TOKENmining questions from GitHub; never exported under a name the app reads
JUDGE_MODEL, JUDGE_BASE_URL, JUDGE_API_KEY, JUDGE_API_STYLEthe judge endpoint; harness only

evals/run/deepeval_env.py forces DeepEval offline (telemetry off, no dotenv loading). A test compares the pinned field list against Settings.model_fields, so adding a Settings field without pinning it for evals fails the build. See the eval harness.

Production smoke test#

.github/workflows/prod-smoke.yml drives the deployed site nightly with SMOKE_BASE_URL, SMOKE_API_URL and SMOKE_REPO_NAME (repository variables) and SMOKE_EMAIL and SMOKE_PASSWORD (secrets). Locally the same names go in client/.env.smoke (from .env.smoke.example). Three optional variables move the suite's guard rails to another pair of origins: SMOKE_ALLOWED_HOSTS (the web hosts the browser may visit), SMOKE_ALLOWED_API_HOSTS (the API hosts it may call) and SMOKE_COOKIE_DOMAIN (the registrable domain the session cookie must be scoped to); their defaults are the production hosts.

Scripts#

scripts/probe_ai_provider.py reads PROBE_PROVIDER, PROBE_MODEL, PROBE_BASE_URL and PROBE_API_KEY (falling back to AI_API_KEY). tests/tools/agent_smoke.py reads AGENT_SMOKE_API_KEY, AGENT_SMOKE_PROVIDER and AGENT_SMOKE_MODEL.

Production#

The droplet's containers all start with --env-file /home/tejas/illume.env, which holds the Settings fields and the LangSmith variables. CI's deploy workflow uses DO_HOST, DO_SSH_KEY and the built-in GITHUB_TOKEN secrets. See deployment.

Design trade-offs and limits#

  • Everything required. Most fields have no default, so configuration mistakes fail loudly at start-up, at the cost of making every import of app need a full environment.
  • Constants are not settings. Tuning auto-update or retrieval needs a deploy, by design.
  • One .env for two jobs. A developer's .env holds production credentials, which is why migrations and test runs need explicit overrides.
  • AI_MODEL is required but optional in meaning. It must be present and may be empty.