# Orchestrator Configuration Example - Multiuser Deployment Mode
#
# This example shows multiuser deployments with HA setup (2 replicas)
# and moderate resource allocation for staging/production.
#
# Usage:
#   nickel export --format toml orchestrator.multiuser.example.ncl > orchestrator.multiuser.toml
#   nickel export --format json orchestrator.multiuser.example.ncl | jq

{
  workspace = {
    root_path = "/var/provisioning/workspace",
    data_path = "/var/provisioning/workspace/data",
    state_path = "/var/provisioning/workspace/state",
    cache_path = "/var/provisioning/workspace/cache",
    isolation_level = 'container,
    execution_mode = 'distributed,
  },

  server = {
    address = "0.0.0.0",
    port = 8080,
    tls = true,
    tls_cert = "/etc/provisioning/certs/server.crt",
    tls_key = "/etc/provisioning/certs/server.key",
    cors = {
      enabled = true,
      allowed_origins = ["https://control-center:8081"],
      allowed_methods = ["GET", "POST", "PUT", "DELETE", "PATCH"],
    },
    rate_limiting = {
      enabled = true,
      requests_per_second = 500,
      burst_size = 100,
    },
  },

  storage = {
    backend = 's3,
    s3 = {
      bucket = "provisioning-storage",
      region = "us-east-1",
      endpoint = "https://s3.amazonaws.com",
    },
    max_size = 107374182400,  # 100GB
    cache_enabled = true,
    cache_ttl = 7200,  # 2 hours
  },

  queue = {
    max_concurrent_tasks = 20,
    retry_attempts = 5,
    retry_delay = 10000,
    task_timeout = 7200000,
    persist = true,
    dead_letter_queue = {
      enabled = true,
      max_size = 10000,
    },
    priority_queue = true,
    metrics = true,
  },

  database = {
    host = "postgres.provisioning.svc",
    port = 5432,
    username = "provisioning",
    pool_size = 20,
    connection_timeout = 15000,
    ssl = true,
  },

  logging = {
    level = 'info,
    format = 'json,
    output = 'file,
    file = "/var/log/provisioning/orchestrator.log",
    max_size = 104857600,  # 100MB
    retention_days = 30,
  },

  monitoring = {
    enabled = true,
    metrics_port = 9090,
    health_check_interval = 10,
    prometheus = {
      enabled = true,
      scrape_interval = "15s",
    },
  },

  security = {
    enable_auth = false,
    auth_backend = 'local,
    token_expiry = 3600,
    enable_rbac = false,
  },

  mode = 'multiuser,

  resources = {
    cpus = "2.0",
    memory = "2048M",
    disk = "100G",
  },

  # Multiuser-specific: HA replicas
  replicas = 2,
  replica_sync = {
    enabled = true,
    sync_interval = 5000,
  },
}
