---
url: /operations/configuration.md
---

# Configuration

Configuration fundamentals: where settings live, how secrets are provided,
which source wins, and where MUCGPT stores data.

## Secrets

**Never store real secrets (passwords, API keys, tokens) in `config.yaml`.** Config files are typically mounted as ConfigMaps (leaking values into etcd) or risk being committed to Git. Provide secrets via **environment variables** instead — they always override YAML values (see [Configuration Priority](#configuration-priority)).

```bash
# Core service
MUCGPT_CORE_REDIS__PASSWORD=secret
MUCGPT_CORE_PROVIDERS__MY_GATEWAY__API_KEY=sk-...

# Assistant service and migrations
MUCGPT_ASSISTANT_DB__PASSWORD=secret
MUCGPT_ASSISTANT_LDAP__BIND_PASSWORD=secret

# Langfuse (standard SDK variables, no MUCGPT_CORE_ prefix)
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_HOST=https://your-langfuse-host.example.com
```

Inject them via Kubernetes Secrets, docker-compose `environment:` entries, or a secret manager — not via the mounted YAML file.

Model API keys are configured **per provider** in the `providers` section (see [Models Configuration](./models.md#models-configuration-yaml)) and can be overridden per provider via environment variables: `MUCGPT_CORE_PROVIDERS__<PROVIDER>__API_KEY`. The middle segment must mirror the provider key (case-insensitively): provider `my_gateway` maps to `MUCGPT_CORE_PROVIDERS__MY_GATEWAY__API_KEY`. Prefer hyphen-free provider keys so the variable is a valid shell identifier. Whole sections can also be replaced: `MUCGPT_CORE_PROVIDERS` (JSON object) and `MUCGPT_CORE_MODELS` (JSON array, see [below](./models.md#models-configuration-environment-variable)) — which can themselves be injected as secrets.

> **Warning:** `MUCGPT_CORE_LANGFUSE__*` environment variables are **no longer read** (silently ignored) — a common migration error. Langfuse is configured exclusively via the standard SDK variables `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, and `LANGFUSE_HOST` (the host defaults to Langfuse cloud if unset). Tracing degrades gracefully: without credentials the core service logs this and runs with tracing disabled.

## Configuration Priority

Settings are loaded in this order (highest priority wins):

1. **Init values** – constructor kwargs / `init_settings`
2. **Environment variables** – `MUCGPT_CORE_*` / `MUCGPT_ASSISTANT_*`, using `__` for nested sections
3. **YAML config file** – `config.yaml` mounted into each container
4. **`.env` file** – lowest priority; values here will **not** override anything set in `config.yaml` or environment variables

This means environment variables always override YAML values. This is the recommended way to provide **secrets** (see [Secrets](#secrets)) and is useful for injecting them in CI/CD without storing them in config files.

## Data storage overview

MUCGPT stores data in two layers:

* PostgreSQL (persistent):
  * Assistants and their versions
  * Assistant subscriptions
  * Conversations (core service): ownership and metadata in `chats`, transcripts as LangGraph checkpoints, canvas documents and the document catalog
* Redis/Valkey (temporary cache):
  * MCP tool metadata cache (core service, key prefix: `mcp_tools_raw_v3:`)
  * LDAP/Active Directory data cache (assistant service, key: `mucgpt:directory-tree:v1`)
  * Assistant compliance verification cache (key prefix: `mucgpt:assistant-compliance:v1:`)

Notes:

* PostgreSQL is the source of truth for assistant and subscription data.
* Redis/Valkey entries are TTL-based and can expire:
  * MCP tools: configured via `mcp.cache_ttl` (default: 12h)
  * LDAP directory cache: configured via `ldap.cache_ttl` (default: 14d)
  * Compliance verification cache: configured via `compliance_cache_ttl_seconds` (default: 30m)

## Browser storage (frontend)

In addition to backend storage, the frontend uses browser storage for UX state and local history:

* IndexedDB:
  * `MUCGPT-ASSISTANTS` (assistant data)
  * `MUCGPT-CHAT` (chat cache, plus favorites and browser-only chats until they are migrated)
  * `MUCGPT-COMMUNITY-ASSISTANTS` (community assistant data)
* localStorage:
  * UI/user preferences (for example language, theme, selected tools, selected model)
  * Pre-chat canvas content until it is saved with a conversation (`canvas-draft`)
  * Parsed document history/content cache (`MUCGPT_PARSED_DOCUMENTS_V1`)
* Cache API (browser):
  * NeMo transcription model files (Canary/Parakeet encoder/decoder/vocab, cache name `mucgpt-nemo-models-v1`)
  * Whisper transcription model files (cached by transformers.js)
  * Transcription model verification markers (cache name `mucgpt-transcription-meta-v1`)
* sessionStorage:
  * Route-local draft text in the question input
* Cookies:
  * `XSRF-TOKEN` is read by the frontend and sent as `X-XSRF-TOKEN` request header

Note: Browser storage is client-local and can be cleared by the user/browser.

## Environment Variable Override Examples

Any YAML setting can be overridden. Nested sections use `__` (double underscore). Env var names stay UPPERCASE and are matched case-insensitively against the lowercase YAML keys:

```bash
# Top-level field
MUCGPT_CORE_VERSION=1.0.0              # → version: "1.0.0"
MUCGPT_CORE_AI_ACT_COMPLIANCE_CHECK_ENABLED=false  # → ai_act_compliance_check_enabled: false

# Nested field (DB section in assistant service)
MUCGPT_ASSISTANT_DB__HOST=postgres      # → db: { host: "postgres" }
MUCGPT_ASSISTANT_DB__PASSWORD=secret    # → db: { password: "secret" }

# Nested field (Redis section in core service)
MUCGPT_CORE_REDIS__HOST=valkey          # → redis: { host: "valkey" }

# Provider api_key (keyed by provider name; segment mirrors the provider key)
MUCGPT_CORE_PROVIDERS__MY_GATEWAY__API_KEY=sk-...  # → providers.my_gateway.api_key
```

> **Warning:** `MUCGPT_CORE_LANGFUSE__*` environment variables are no longer read (silently ignored). Use the standard `LANGFUSE_PUBLIC_KEY` / `LANGFUSE_SECRET_KEY` / `LANGFUSE_HOST` variables instead — see [Secrets](#secrets).
