# Attune Development Environment Configuration
# This file overrides base config.yaml settings for development

environment: development

# Development database
database:
  url: postgresql://postgres:postgres@localhost:5432/attune
  log_statements: true # Enable SQL logging for debugging
  schema: "public" # Explicit schema for development

# Development message queue
message_queue:
  url: amqp://guest:guest@localhost:5672
  rabbitmq:
    worker_queue_ttl_ms: 300000 # 5 minutes - expire unprocessed executions
    dead_letter:
      enabled: true
      exchange: attune.dlx
      ttl_ms: 86400000 # 24 hours - retain DLQ messages for debugging

# Development server
server:
  host: 127.0.0.1
  port: 8080
  cors_origins:
    - http://localhost:3000
    - http://localhost:3001
    - http://localhost:3002
    - http://localhost:5173
    - http://127.0.0.1:3000
    - http://127.0.0.1:3001
    - http://127.0.0.1:3002
    - http://127.0.0.1:5173

# Development logging
log:
  level: debug
  format: pretty # Human-readable logs for development
  console: true

# Development security (weaker settings OK for dev)
security:
  jwt_secret: dev-secret-not-for-production
  jwt_access_expiration: 86400 # 24 hours (longer for dev convenience)
  jwt_refresh_expiration: 2592000 # 30 days
  encryption_key: test-encryption-key-32-chars-okay
  enable_auth: true
  allow_self_registration: true
  oidc:
    enabled: false
    discovery_url: https://auth.rdrx.app/.well-known/openid-configuration
    client_id: 31d194737840d32bd3afe6474826976bae346d77247a158c4dc43887278eb605
    client_secret: null
    redirect_uri: http://localhost:3000/auth/callback
    post_logout_redirect_uri: http://localhost:3000/login
    scopes:
      - groups
  ldap:
    enabled: false
    url: ldap://localhost:389
    bind_dn_template: "uid={login},ou=users,dc=example,dc=com"
    provider_name: ldap
    provider_label: Development LDAP

# Packs directory (where pack action files are located)
packs_base_dir: ./packs

# Runtime environments directory (virtualenvs, node_modules, etc.)
# Isolated from pack directories to keep packs clean and read-only.
# Pattern: {runtime_envs_dir}/{pack_ref}/{runtime_name}
runtime_envs_dir: ./runtime_envs

# Artifacts directory (shared volume for file-based artifact storage).
# File-type artifacts are written here by execution processes and served by the API.
# Pattern: {artifacts_dir}/{ref_slug}/v{version}.{ext}
artifacts_dir: ./artifacts

# Worker service configuration
worker:
  service_name: attune-worker-e2e
  worker_type: local
  max_concurrent_tasks: 10
  heartbeat_interval: 10 # Reduced from 30s for faster stale detection
  task_timeout: 120 # 2 minutes default
  cleanup_interval: 60
  work_dir: ./tests/artifacts
  python:
    executable: python3
    venv_dir: ./tests/venvs
    requirements_timeout: 120
  nodejs:
    executable: node
    npm_executable: npm
    modules_dir: ./tests/node_modules
    install_timeout: 120
  shell:
    executable: /bin/bash
    allowed_shells:
      - /bin/bash
      - /bin/sh

# Sensor service configuration
sensor:
  service_name: attune-sensor-e2e
  heartbeat_interval: 10
  max_concurrent_sensors: 20
  sensor_timeout: 120
  shutdown_timeout: 30
  polling_interval: 5 # Check for new sensors every 5 seconds
  cleanup_interval: 60

# Notifier service configuration
notifier:
  service_name: attune-notifier-e2e
  websocket_host: 127.0.0.1
  websocket_port: 8081
  heartbeat_interval: 30
  connection_timeout: 60
  max_connections: 100
  message_buffer_size: 1000

# Executor service configuration
executor:
  scheduled_timeout: 120 # 2 minutes (faster feedback in dev)
  timeout_check_interval: 30 # Check every 30 seconds
  enable_timeout_monitor: true

# Agent binary distribution (optional - for local development)
# Binary is built via: make build-agent
# agent:
#   binary_dir: ./target/x86_64-unknown-linux-musl/release
