# =============================================================================
# pgpipe configuration — paired with the docker-compose.yml on this site
# =============================================================================
# Wires pgpipe to the source-db and dest-db services in docker-compose.yml.
# When you adapt this for your own databases:
#   - point host / user / password at your real PG instances
#   - keep secrets out of YAML in production (use ${ENV_VAR} expansion or a
#     secret manager and bind the dashboard behind TLS)
# =============================================================================

pipeline:
  name: docker-demo
  log_level: info

# ---------------------------------------------------------------------------
# Source PostgreSQL
# Required on the source:
#   wal_level             = logical
#   max_replication_slots >= 1
#   max_wal_senders       >= 1
# ---------------------------------------------------------------------------
source:
  host: source-db
  port: 5432
  database: source_db
  user: postgres
  password: postgres
  ssl_mode: disable

  replication:
    slot_name: pgpipe_demo
    publication_name: pgpipe_pub
    wal_level_check: true

  tables:
    - schema: public
      name: greetings

  # DDL replication uses event triggers on the source. The setup_schema is
  # where pgpipe stores its event-trigger plumbing. The schema must exist
  # before pgpipe runs (init-source.sql creates it).
  ddl:
    enabled: true
    method: event_trigger
    poll_interval: 2s
    setup_schema: pgpipe

  # Heartbeat detects stalled-source conditions in production. Off by default
  # for the demo; turn on once your operational pipeline can pre-create the
  # heartbeat table or your pgpipe build auto-creates it.
  heartbeat:
    enabled: true
    interval: 10s
    table: pgpipe.heartbeat

destination:
  host: dest-db
  port: 5432
  database: dest_db
  user: postgres
  password: postgres
  ssl_mode: disable

  pool:
    max_connections: 10
    min_connections: 1

  write:
    mode: upsert
    ordering: strict
    batch_size: 700
    batch_timeout: 200ms
    statement_timeout: 30s

snapshot:
  mode: initial
  workers: 4
  fetch_size: 5000
  disable_triggers: true

state:
  backend: boltdb
  boltdb:
    path: /var/lib/pgpipe/state.db
  checkpoint_interval: 3s

server:
  enabled: true
  listen: :8080
  auth:
    enabled: true
    username: admin
    password: ""
  tls:
    enabled: false

metrics:
  enabled: true
  path: /metrics

errors:
  dlq:
    enabled: true
    max_entries: 1000
    retry_interval: 10s
    max_retries: 3
  retry:
    initial_backoff: 1s
    max_backoff: 15s
    max_duration: 2m0s
