Skip to content

Environment Variables (.env)

The entire configuration of the Ontheia platform is done via environment variables. These are loaded when the Docker containers (or the local Node.js process) are started.

VariableDescriptionDefault
APP_ENVEnvironment type (development or production).development
PORTPort on which the host service listens.8080
LOG_LEVELLogging detail level (debug, info, warn, error).info
APP_TIMEZONEGlobal process timezone (e.g., Europe/Berlin, UTC). Used for cron scheduling and date formatting.Europe/Berlin
PINO_PRETTYIf true: Colorized, readable log output. For development only.
LOG_FILEPath to the rotating log file.<cwd>/host_server.log
LOG_MAX_BYTESMaximum log file size in bytes before rotation.10485760 (10 MB)
LOG_MAX_FILESNumber of rotated log files to keep.5

Ontheia uses PostgreSQL with the pgvector extension.

VariableDescription
DATABASE_URLFull connection string for the host service. Important: Must use a restricted user (see Section 9).
FLYWAY_URLJDBC URL for database migrations.
FLYWAY_USERUsername for migrations (must be superuser postgres).
FLYWAY_PASSWORDPassword for the superuser.

These variables control API access and browser security.

VariableDescription
ALLOWED_ORIGINSComma-separated list of allowed domains/IPs for CORS. Supports wildcards (e.g., http://192.168.2.*).
METRICS_TOKENBearer token required to scrape /metrics. Generated on a fresh installation; if empty, the endpoint stays open and the host logs a warning at startup. See Metrics.
VariableDescription
ROOTLESS_DOCKER_HOSTPath to the Rootless user’s Docker socket.
DOCKER_NETWORKName of the Docker network for MCP containers. Default: ontheia-net.
DOCKER_BINPath to the Docker binary. Default: docker.
ALLOWLIST_IMAGES_PATHOverrides the path to the allowed Docker images file.
ALLOWLIST_URLS_PATHOverrides the path to the allowed egress URLs file.
ALLOWLIST_PACKAGES_NPM_PATHOverrides the path to the npm package allowlist.
ALLOWLIST_PACKAGES_PYPI_PATHOverrides the path to the PyPI package allowlist.
ALLOWLIST_PACKAGES_BUN_PATHOverrides the path to the Bun package allowlist.
ORCHESTRATOR_HARDENING_PATHOverrides the path to the hardening configuration (JSON).
MCP_CLIENT_CONNECT_TIMEOUT_MSTimeout for establishing connections to MCP servers.
ALLOWLIST_CLI_COMMANDS_PATHPath to the cli-tools command allowlist (allowlist.cli-commands). Format per line: command: description or just command. Default: config/allowlist.cli-commands relative to cli_server.py.
COMMAND_TIMEOUTTimeout in seconds for individual shell commands executed by the cli-tools server. Default: 30.
VariableDescriptionDefault
SKILLS_BASE_DIRBase directory for skill files inside the container. The ScanService scans <SKILLS_BASE_DIR>/global/ and <SKILLS_BASE_DIR>/user/ on startup./app/host/sources/skills
FILES_SKILL_ROOTSColon-separated directories the bundled files skill may access. Supports a {user} placeholder (per-user isolation, resolved from the requesting user’s email — see the skill’s Admin Guide in its SKILL.md). The email local part (before the @) is unique instance-wide so two accounts can never share a directory. Paths must be reachable inside the host container./tmp (skill); .env.example presets /data/files/{user}
FILES_SKILL_MAX_READCharacter cap per read operation of the files skill (pagination via --offset).15000
FILES_SKILL_MAX_SEARCH_RESULTSResult cap for files-skill searches.50
FILES_SKILL_MAX_CONTENT_SCAN_MBPer-file size cap (MB) for content search in the files skill.2

The host directory sources/skills/ is mounted into the container at /app/host/sources/skills via the volume binding ./sources:/app/host/sources in docker-compose.yml. The files skill’s default root /data/files is mounted from ./data/files.

VariableDescription
OPENAI_API_KEYGlobal API key (if not configured via UI).
ANTHROPIC_API_KEYGlobal API key for Anthropic.
XAI_API_KEYGlobal API key for xAI (Grok).
PROMPT_OPTIMIZER_CHAIN_IDUUID of the chain used for prompt optimization.
EMBEDDING_CONFIG_PATHPath to the embedding configuration file (embedding.config.json). Optional: The database configuration (Administration → AI Provider → Embedding tab) takes precedence. This file is only used as a fallback.
MAX_PROMPT_TOKENSMaximum allowed prompt tokens per LLM request. If a response reports a larger prompt, the run is aborted immediately with an error to prevent context explosion loops (e.g. caused by large binary files accidentally loaded into the conversation history). Default: 200000.

These variables are used by the setup.sh script to create the initial administrator account.

VariableDescription
ADMIN_EMAILEmail address of the initial administrator.
ADMIN_PASSWORDPassword for the initial administrator.
ADMIN_FNAMEFirst name of the administrator (for personalization).
ADMIN_LOCALEDefault language (de-DE or en-US).

These variables must be prefixed with VITE_ to be available in the browser code. Important: These values are hardcoded into the WebUI during the build process (docker build).

VariableDescription
VITE_HOST_API_URLThe URL where the frontend can reach the host service (e.g., http://192.168.2.13:8080).
VITE_PROMPT_OPTIMIZER_CHAIN_IDMust be identical to PROMPT_OPTIMIZER_CHAIN_ID.

To guarantee the isolation of user data (Row Level Security), the following rules apply:

The application must not be connected to the database as superuser (postgres), as PostgreSQL ignores RLS rules for superusers by default.

  • Use the user ontheia_app in DATABASE_URL.
  • The password is set via migration V41.

Since migration V45, a strict privacy policy applies:

  • Chats: Even administrators cannot see the private chats of other users.
  • Memory: Administrators can only manage memory namespaces if the user has explicitly allowed this in their profile settings (“Admin may manage my memory namespaces”).

Avoid exporting DATABASE_URL as an environment variable in your shell. Docker Compose prefers shell variables over the .env file, which can lead to the container accidentally starting with incorrect credentials (e.g., localhost instead of db).


Terminal window
APP_ENV=production
ALLOWED_ORIGINS=http://192.168.2.*,http://localhost:5173
VITE_HOST_API_URL=http://192.168.2.13:8080
# Administrator
ADMIN_EMAIL=admin@ontheia.local
ADMIN_FNAME=Wolfgang
ADMIN_LOCALE=de-DE
# Secure App-User for RLS
DATABASE_URL=postgresql://ontheia_app:ontheia_app_pwd_123@db:5432/ontheia
# Superuser only for Flyway migrations
FLYWAY_URL=jdbc:postgresql://db:5432/ontheia
FLYWAY_USER=postgres
FLYWAY_PASSWORD=postgres