# iq-sdk Sites Configuration
#
# Environment variables with IQ_ prefix override these values.
# API secrets should be set via environment variables for security:
#   IQ_SITE_DEFAULT_API_SECRET=secret
#   IQ_SITE_PRODUCTION_API_SECRET=prod-secret
#
# Or use file references (K8s/Docker secrets style):
#   IQ_SITE_PRODUCTION_API_SECRET_FILE=/run/secrets/prod-secret
#
# For JSON/YAML secrets, extract with _API_SECRET_KEY (dot-notation):
#   IQ_SITE_PRODUCTION_API_SECRET_FILE=/etc/secrets/creds.json
#   IQ_SITE_PRODUCTION_API_SECRET_KEY=credentials.api_secret
#
# Custom env vars support ${VAR} interpolation from runtime:
#   env:
#     API_KEY: "${API_KEY:-default-key}"
#     DEBUG: "true"

project_name: "{{ name }}"
version: "0.1.0"

# Worker ID (optional, auto-derived from hostname if not set)
# worker_id: "my-worker"

# Default site configuration
site:
  id: "default"
  host: "http://localhost:8000"
  api_key: ""
  # api_secret: ""  # Use IQ_SITE_DEFAULT_API_SECRET env var instead!

  # Custom environment variables (interpolated from runtime ENVs)
  env: {}
  #   API_KEY: "${API_KEY:-default-key}"
  #   LOG_LEVEL: "debug"

  # Tools to run on this site
  tools: []
  #   - name: "my-tool"
  #     queue: "my-queue"  # optional, defaults to tool name
  #     threads: 2         # optional, defaults to worker.threads
  #   - "another-tool"     # shorthand: just the name

# Additional sites
sites: []
  # - id: "production"
  #   active: true                # Can be overridden by IQ_SITE_PRODUCTION_ACTIVE=0
  #   host: "${PROD_HOST:?Production host required}"
  #   api_key: "prod-worker"
  #   # api_secret via: IQ_SITE_PRODUCTION_API_SECRET
  #   env:
  #     API_KEY: "${PROD_API_KEY}"
  #   tools:
  #     - "my-tool"
  #
  # - id: "staging"
  #   active: false               # Disabled by default, enable with IQ_SITE_STAGING_ACTIVE=1
  #   host: "http://staging.example.com:3000"
  #   api_key: "stage-worker"
  #   tools:
  #     - name: "my-tool"
  #       threads: 1

# Default worker configuration (can be overridden per site/tool)
worker:
  threads: 1
  min_threads: 1
  max_threads: 16
  autoscale: false
  autoscale_interval: 30
  heartbeat_interval: 10

  # Retry settings for failed output submissions
  # When task output fails to send (host unreachable, errors), it's queued
  # locally in ./data/{site}/queue-output/ and retried with exponential backoff.
  # retry:
  #   max_retries: 10          # Max attempts before moving to failed queue
  #   initial_delay: 10        # Initial retry delay in seconds
  #   max_delay: 3600          # Maximum retry delay (1 hour)
  #   backoff_multiplier: 2.0  # Exponential backoff multiplier

# Logging configuration
logging:
  level: "INFO"
  format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
  # file: "logs/worker.log"

# Tools directory
tools_dir: "tools"
