Skip to main content

Environment Variables

UI Is the Primary Configuration Method

Most O.D.I.N. configuration (SMTP, notifications, integrations, branding) is done through the Settings UI and stored in the database. Environment variables are used for Docker-level bootstrapping — secrets, database path, server binding, and a few override options that cannot be changed after container start.


Auto-Generated Secrets

These three secrets are auto-generated on first run if not provided. They are persisted to /data/ inside the volume so they survive container restarts.

Do Not Set These Manually in docker-compose.yml

If you set these in your compose file, you risk accidentally rotating them on container recreate, which invalidates all existing sessions and encrypted data. Let O.D.I.N. manage them automatically. The only reason to set them manually is for disaster recovery when restoring from a backup.

VariableDescriptionAuto-Generated Path
ENCRYPTION_KEYFernet key for encrypting secrets at rest (printer API keys, SMTP passwords, webhook URLs)/data/.encryption_key
JWT_SECRET_KEYHS256 key for signing JWT session tokens/data/.jwt_secret
API_KEYSystem-level API key for service-to-service authAuto-generated if blank

Server Configuration

VariableDefaultDescription
DATABASE_URLsqlite:////data/odin.dbSQLite connection string. Do not change the path — it must match the Docker volume mount.
HOST0.0.0.0Bind address for the FastAPI server
PORT8000Listening port for the web UI and API
CORS_ORIGINShttp://localhost:8000,http://localhost:3000Comma-separated list of allowed CORS origins
COOKIE_SECUREtrueSet to false for local HTTP development (disables the Secure flag on session cookies)
COOKIE_SAMESITEstrictCookie SameSite policy. Set to lax if your OIDC identity provider is cross-origin.
ODIN_HOST_IPAuto-detectedLAN IP used for go2rtc WebRTC ICE candidates. Set explicitly if auto-detection picks the wrong interface or Docker bridge IP.
TZAmerica/New_YorkTimezone for log timestamps and scheduler quiet hours
DEBUGfalseEnable FastAPI debug mode (verbose errors)

PostgreSQL (Optional)

VariableDefaultDescription
POSTGRES_URL(none)PostgreSQL connection string (e.g., postgresql://user:pass@host:5432/odin). When set, O.D.I.N. uses PostgreSQL instead of SQLite. Recommended for farms with 20+ printers or multi-instance deployments.

MCP Server

VariableDefaultDescription
MCP_ENABLEDfalseEnable the built-in Model Context Protocol server. When true, O.D.I.N. exposes an MCP endpoint for AI assistant integration (Claude, GPT, etc.).

For the standalone odin-print-farm-mcp@2 npm package (recommended for most agent use cases), configure the client-side environment:

VariableRequiredDescription
ODIN_BASE_URLYesFull URL of your O.D.I.N. instance (e.g., http://192.168.1.100:8000). Used by the MCP package to reach your backend.
ODIN_API_KEYYesPer-user scoped token (odin_... prefix) with scope agent:read or agent:write. See MCP Server.

ITAR / CMMC Mode

VariableDefaultDescription
ODIN_ITAR_MODE0Set to 1 to enable fail-closed air-gap mode. O.D.I.N. refuses to boot if any configured outbound destination resolves to a public address; every runtime outbound call (HTTP / SMTP / MQTT) is DNS-pinned and proxy-bypass-proofed. APNs and Web Push are hard-disabled. See ITAR / CMMC Mode.

OIDC Configuration

VariableDefaultDescription
OIDC_REDIRECT_URIDerived from request.base_urlPin the OIDC callback URL when behind a reverse proxy. Example: https://odin.example.com/api/auth/oidc/callback. Required if the auto-detected URL resolves to an internal address.

Spoolman Integration

VariableDefaultDescription
SPOOLMAN_URL(none)Base URL of your Spoolman instance (e.g., http://192.168.1.x:7912). When set, O.D.I.N. syncs filament consumption to Spoolman on print completion.

Scheduler Configuration

These variables set defaults for the job scheduler. They can also be adjusted in the Settings UI.

VariableDefaultDescription
BLACKOUT_START22:30Quiet hours start time (24h). Jobs are not dispatched during quiet hours.
BLACKOUT_END05:30Quiet hours end time (24h).
SCHEDULER_HORIZON_DAYS7How far ahead the scheduler looks when assigning time windows (days).

Docker Compose Example

The minimal docker-compose.yml from the official installer:

services:
odin:
image: ghcr.io/hughkantsime/odin:latest
container_name: odin
restart: unless-stopped
ports:
- "8000:8000" # Web UI + API
- "1984:1984" # go2rtc API
- "8555:8555" # go2rtc WebRTC
volumes:
- ./odin-data:/data
- ./odin-data/go2rtc:/app/go2rtc
environment:
# Auto-generated on first run if left blank
- ENCRYPTION_KEY=${ENCRYPTION_KEY:-}
- JWT_SECRET_KEY=${JWT_SECRET_KEY:-}
- API_KEY=${API_KEY:-}
- DATABASE_URL=sqlite:////data/odin.db
- CORS_ORIGINS=http://localhost:8000,http://localhost:3000
# Set to your server's LAN IP for WebRTC camera streaming
- ODIN_HOST_IP=${ODIN_HOST_IP:-}
- TZ=${TZ:-America/New_York}
# Optional: PostgreSQL backend (omit to use SQLite)
# - POSTGRES_URL=postgresql://user:pass@host:5432/odin
# Optional: MCP server for AI assistant integration
# - MCP_ENABLED=false
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s

See Also