# Root compose defaults (safe for local self-host / dev)
# Copy to .env to override.

# --- app ports (host) ---
FRONTEND_PORT=3000
BACKEND_PORT=8000

# --- database ---
POSTGRES_DB=pipeline
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_PORT=5432

# --- backend settings (see backend/.env.example for full list) ---
# REQUIRED: Public URL the backend should advertise in generated instructions/webhook flows.
# Update this when the backend is served behind a reverse proxy, custom host, or non-default port.
BASE_URL=http://localhost:8000
# Origins the browser is allowed to call the API from.
# Must match the URL you open Pipeline on in your browser — not the Forgejo URL.
# For local dev: http://localhost:3000
# For a deployed instance: https://pipeline.example.com
# Multiple origins: comma-separated — e.g. https://pipeline.example.com,http://localhost:3000
# Leave blank to disable CORS headers (only safe when frontend and backend share the same origin).
CORS_ORIGINS=http://localhost:3000
DB_AUTO_MIGRATE=true
LOG_LEVEL=INFO
REQUEST_LOG_SLOW_MS=1000
AUTH_MODE=local
# REQUIRED when AUTH_MODE=local (must be non-placeholder and at least 50 chars).
LOCAL_AUTH_TOKEN=

# --- Docker user (must match host uid:gid so containers can read host-owned files) ---
# Run `id -u` and `id -g` on your host to get the right values.
# Defaults to 1000:1000 which is correct for most single-user Linux installs.
DOCKER_UID=1000
DOCKER_GID=1000

# --- AI provider credentials (local mode only) ---
# Pipeline reads local credential files on every boot and upserts provider rows
# automatically — no manual configuration required if you have Claude Code or
# Codex CLI installed:
#
#   Anthropic  ~/.claude/.credentials.json   (claudeAiOauth.accessToken)
#   OpenAI     ~/.codex/auth.json            (tokens.access_token)
#
# Override the credential file paths if they live elsewhere:
# CLAUDE_CREDENTIALS_PATH=/path/to/.credentials.json
# CODEX_CREDENTIALS_PATH=/path/to/auth.json
#
# Supplement with explicit API keys (used alongside session tokens):
# ANTHROPIC_API_KEY=sk-ant-...
# OPENAI_API_KEY=sk-...
# OPENAI_BASE_URL=http://localhost:11434/v1   # Ollama, Azure, etc.

# --- frontend settings ---
# REQUIRED: Public URL used by the browser to reach the API.
# Use `auto` to target the same host currently serving Pipeline on port 8001.
# Example (explicit override): NEXT_PUBLIC_API_URL=https://mc.example.com
NEXT_PUBLIC_API_URL=auto
NEXT_PUBLIC_AUTH_MODE=local
# Local auth token (used when NEXT_PUBLIC_AUTH_MODE=local).
# When set: the app loads directly without showing the login screen.
# When unset: users are prompted to enter their token on first load.
# Must be at least 50 characters and match LOCAL_AUTH_TOKEN above.
NEXT_PUBLIC_LOCAL_AUTH_TOKEN=
